Installing MySQL on Linux

I know there is already how tos out there but I figured I would post my own, just to make it easier for me to find it if I need it in the future.

To install MySQL run the following command in Terminal

$sudo apt-get install mysql-server

During the install you will be prompted to enter the root password, you can later change this.

MySQL should now be running to check this type:

sudo netstat -tap | grep mysql

You should see the following output:

tcp        0      0 localhost:mysql         *:*                     LISTEN      2556/mysqld

You can edit the /etc/mysql/my.cnf file to configure the basic settings — log file, port number, etc. For example, to configure MySQL to listen for connections from network hosts, change the bind-address directive to the server’s IP address:

bind-address  =

er making a change to /etc/mysql/my.cnf the mysql daemon will need to be restarted:

sudo /etc/init.d/mysql restart

If you would like to change the MySQL root password, in a terminal enter:

sudo dpkg-reconfigure mysql-server-5.1

The mysql daemon will be stopped, and you will be prompted to enter a new password.