You are on page 1of 10

SQL in a server

System Preferences
64-Bit High Memory Multiple core CPU Multiple CPU Quality network devices Server OS

Other Settings
key_buffer_size (30% of total RAM recommended; 4GB Max. Memory query_cache_size (32M512M) read_buffer_size, read_rnd_b uffer_size (around 1-6MB)

<http://www.devshed.com/c/a/MySQL/MySQL-Server-Tuning-Tips-and-Tricks/2/>

Setup
Setting up for a mysql server is much like the one in a developer machine but with different settings

A developer machine accesses the mysql server locally. Database server has clients that can connect to that server

Instance Configuration
Mysql servers have a limited of allocated concurrent connections to limit the stress of the server.

The server must have secure passwords. Root access from remote machines allows other machines to access the root account

Reminders

Update firewall rules to make sure port# is available in this case port 3306 Make sure the port number is consistent or known with the client applications

<http://www.tutorialspoint.com/mysql/mysql-administration.htm>

Granting user permissions


The root can also grant users on what to do
Sample code for granting access to the database
GRANT SELECT,UPDATE,INSERT ON Database.* TO username'@host' IDENTIFIED BY Password GRANT SELECT,UPDATE,INSERT ON weblounge.* TO userx'@'%' IDENTIFIED BY x

FLUSH PRIVILEGES; // to be used after grant

Sample root login

Login of account granted by root

Client calling to the server


In this example the a mysql client is calling for the host though the ip address.

Another way is if the client knows the hostname

Other commands for remote user:

USE Databasename : This will be used to select a particular database SHOW DATABASES: Lists the databases that are accessible SHOW TABLES: Shows the tables in the database once a database has been selected SHOW COLUMNS FROM tablename: Shows the attributes, types of attributes, key information, whether NULL is permitted, defaults, and other information for a table. SHOW INDEX FROM tablename: Presents the details of all indexes on the table, including the PRIMARY KEY. SHOW TABLE STATUS LIKE tablename\G: Reports details of the MySQL DBMS performance and statistics. http://www.tutorialspoint.com/mysql/mysql-administration.htm

Back-up
mysqldump -u <username> -p <database> > file.sql mysqldump -u root -p sampleDB file.sql > dump.sql

Recovery
mysql -u admin -p vworks < vworks.sql

References
http://whatis.techtarget.com/definition/server http://www.sequelpro.com/docs/Connecting_to_a_MySQL_Server_on_a_Remote_Host http://chosencollective.com/technology/how-to-enable-remote-access-to-mysql http://richbui.com/2009/03/06/how-to-enable-remote-access-to-mysql-server-on-windows-server/ http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_skip-networking http://www.webhostingtalk.com/showthread.php?t=583298 http://www.tutorialspoint.com/mysql/mysql-administration.htm http://www.devshed.com/c/a/MySQL/MySQL-Server-Tuning-Tips-and-Tricks/2/

You might also like