Installing MySQL on Ubuntu server

To install MySQL on Ubuntu, you need to follow some simple steps:

1. run the installation command in the console:

$ sudo apt-get install mysql-server mysql-client libmysqlclient12-dev

This command installs all necessary for work with MySQL packages.

2. After successful installation, in order to to our database you can connect, open to edit the MySQL configuration file by running:

# vi/etc/mysql/my.cnf

3. Find the line type “bind-address = 127.0.0.1” and write it, giving it the appearance of:

#bind-address = 127.0.0.1 (the # sign indicates that the subsequent line will not be considered)

4. then start the MySQL daemon:

#/etc/init.d/mysql restart

and check with netstat “listening” port for MySQL:

# netstat-tap

among the appeared on the screen we see a line like:

TCP 0 0 *: mysql *:* LISTEN 3306/mysqld

This means that the mysqld daemon listens on port 3306 (the value can be changed in the configuration file/etc/mysql/my.cnf)

5. Now we need to assign a password to the local user root (that is de rigeur, and will provide the best security database) by running the following command at your console:

# mysqladmin-u root password naznačaemyj_parol′

# mysqladmin-h root @ lokal′noe_imâ_servera-u root-p password naznačaemyj_parol′

and restart mysqld:

#/etc/init.d/mysql restart