Ubuntu MySQL installation and configuration remote login tutorial, tumysql
This article provides an example of how to install MySQL and configure remote logon for your reference. The details are as follows:
1. Install MySQL
1. Install MySQL
1. sudo apt-get install mysql-server
2. sudo apt-get install mysql-client
3. sudo apt-get install libmysqlclient-dev
Note: during the installation process, you will be prompted to set the password and confirm the password. Remember the password.
After the installation is complete, run the following command to check whether the installation is successful:
root@root:/# ps aux|grep mysqlmysql 9323 1.4 10.3 1115748 138308 ? Ssl 22:34 0:00 /usr/sbin/mysqldroot 9486 0.0 0.0 21312 928 pts/18 S+ 22:34 0:00 grep --color=auto mysql
The above result indicates that the installation is successful.
Log on to the mysql database using the following command:
Previously, I set the password as root.
root@root:/# mysql -uroot -proot
-U indicates the login user name,
-P indicates the Login User Password
2. configure remote Logon
1. Open the configuration file
root@root:/# sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
2. modify the configuration file
Modify bind-address = 127.0.0.1 to 0.0.0.0 or comment out
3. Add Remote Access Permissions
root@root:/# mysql -uroot -proot->GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;->FLUSH PRIVILEGES;
The above user and password can be set to your own
4. Check whether the operation is successful.
root@root:/# netstat -an | grep 3306 tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
The preceding result indicates that the setting is successful.
5. Restart MySQL
root@root:/# service mysql restart
6. Test the connection
Find the IP address through ifconfig
Test the connection on Navicat
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.