Wednesday, July 29, 2009

Installing and configuring mysql on ubuntu

Open terminal.

Enter following commands.

$ sudo apt-get install mysql-server mysql-client
$ mysql_secure_installation

First command will install mysql server and client both.
Second command is not required butif you want to make your database more secure, it is helpful.
Default port for mysql is 3306. If you wish to change this, you can do so by editing mysql configuration (my.cnf) file which is located under /etc/mysql.

$ sudo vi /etc/mysql/my.cnf

Look for string port=3306
Update it to your desired port number.
Once you save my.cnf file, you will have to restart mysql server to effect your changes.
You can use following command (remove curly brackets) to start,stop or restart mysql server.

$ service mysql {start|stop|restart}


No comments:

Post a Comment