First, install MySQL
1. The installation needs to use the root account, if you do not set the root account, Google. In the process of installing MySQL, you need to set the password of the root account of MySQL, do not ignore it.
sudo apt-get install mysql-serverapt isntall mysql-clientapt Install Libmysqlclient-dev
2. After the installation of the above 3 packages, use the following command to query whether the installation was successful:
sudo netstat-tap | grep MySQL
The query results, as shown, indicate that the installation was successful.
[Email protected]:~# Netstat-tap | grep mysqltcp6 0 0 [::]:mysql [::]:* LISTEN 7510/mysqld
Ways to allow remote users to log in to access MySQL
To use the root user from any host, password: youpassword (your root password) to connect to the MySQL server:
# mysql-u Root-proot
Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' Youpassword ' with GRANT OPTION;
After the operation, remember to perform the following command refresh permissions
FLUSH Privileges
2. Modify the IP bindings in the my.conf
# 进入编辑/etc/mysql/mysql.conf.d/mysqld.conf
vi /etc/mysql/mysql.conf.d/mysqld.conf
# 修改ip绑定
# 源文件中为:
bind
-address
127.0.0.1
# 将其修改为:
bind
-address
0.0.0.0
# 覆盖保存
When connecting MySQL data remotely using the Navicat for MySQL client software, the connection appears 2003-can ' t connect to the MySQL on ' 192.168.1.2 ' (10061) error, because MySQL does not allow remote connections.
Here's how to modify it:
1: Locate the My.ini file under the server MySQL folder. Modify bind-address=127.0.0.1 to bind-address=0.0.0.0
2: Restart the MySQL service.
Test the connection condition:
"1045-access denied for user ' [email protected] (using Password:no)" will appear if the remote login user is not added to the permissions that all machines can access, which indicates the need to add permissions;
Add the following command:
1) Grant all on * * to username @ "%" identified by "password";
2) flush privileges;
By completing the above steps, you can access the MySQL database remotely.
Install MySQL above ubuntu