Original: Ubuntu install MySQL
First, verify that the original host has MySQL installed: Here is the main run of sudo netstat-tap | grep mysql command to see if there is a MySQL listening port:
$ netstat -tap | grep mysql
Second, install MySQL:after confirming that the host does not have MySQL installed, run the command sudo apt-get install mysql-server mysql-client for online installation:
$ sudo apt-get install mysql-server mysql-client
During the installation, you will be prompted to enter Yes, and then the root Password Settings screen, you can set up a root password as a login to the MySQL user, and then need to run mysqladmin-u root-p password to change the password, Of course, the original password must be entered first.
$ mysqladmin -u root -p password
third, start MySQL:ubuntu default boot starts the MySQL service, and at the same time, you can also enter the command to start and close MySQL:
# 启动MySQL
$ sudo service mysql start
# 关闭MySQL
$ sudo service mysql stop
# 重启MySQL
$ sudo service mysql restart
# 其他命令:
$ sudo /etc/init.d/mysql start
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql restart
then, type the command again to check if MySQL has started:
$ netstat -tap | grep mysql
MySQL listens on localhost, stating that MySQL is already started.
iv. Log in to MySQL:log in to MySQL using the command line mysql-u root-p:
$ mysql -u root -p
P.S. Recently tried ubuntu to install MySQL for reference. For configuration issues, the following is resolved.
Ubuntu install MySQL