MySQL remote connection settings
This is just a simple Mysql setting. However, many images are simple, but security is ignored. Therefore, you must be clear about the details and meanings of the settings.
The steps are as follows:
1. log on to the local mysql Server:
#mysql -uroot -p
Enter the password and enter mysql. The parameter-u is the user name, here is the root login,-p is to enter the password.
2. use and view mysql User access permissions
>use mysql;>select host,user from user;
3. you can see that the root user can access it locally (using the default mysql installation method ). To run remote access, add the following permissions:
>GRANT ALL PRIVILEGES ON *.* TO ‘myuser’@'%’ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;
Here are some notes: all privileges refers to ALL database operations; *. * refers to ALL databases and data tables in the mysql database; % refers to access by running ALL external IP addresses. Myuser and mypassword are the usernames and passwords of the users you want to authorize.
All permissions for the user's database are given here. But in practical applications, the administrator is not responsible.
>GRANT ALL PRIVILEGES ON *.* TO ‘root’@’192.168.1.3′ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;
The following is a good practice:
>GRANT ALL PRIVILEGES ON *.* TO ‘root’@’192.168.1.2′ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;>GRANT ALL PRIVILEGES ON mydb.* TO ‘other’@’192.168.1.2′ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;
Article 1 The root user can access the database from the machine 192.168.1.2 on the intranet.
Article 2 other is provided to access all tables of mydb data in this database from machines 192.168.1.2 on the intranet.
4. to make the preceding settings take effect immediately, run the following command:
>FLUSH PRIVILEGES;
This allows the mysql Server to load the authorization table again.