Configure remote access for mysql
By default, mysql cannot be called remotely. In the project development process, this situation cannot be avoided.
Install mysql. This installation-free version has been introduced in the relevant blog.
See:MysqlInstallation configuration and common operations without installation.
Installation download: http://dev.mysql.com/downloads/mysql/
Whether the database is installed or not, mysql will bring a database named mysql. The user table is maintained by the mysql database, so our operation is actually the access permission for this user. The problem is clear. If the access fails,
First case: the user table does not have this user, that is, the user field of the user table does not have this user
Case 2: The user exists in the user table, and the user has no permission to access other tables, the permissions are also maintained by the mysql user, db, host, table_priv, and columns_priv tables.
The problem is clear, followed by specific solutions to the problem
Solution 1:
After Login
Mysql> use mysql
Check whether the user and password exist in the user table.
Mysql> select host, user, password from user;
Set root unlimited access to remote calls for mysql
Update user set host = '%' where user = 'root ';
Grant all privileges on *. * to root @ '%' identified by "root ";
Solution 2: create a user and authorize the user
// Create a user with the specified password and host
Create user 'username' @ 'host' identified by 'Password ';
Host: Address of the mysql server to be accessed/username: username password: password
Grant all privileges on user. * TO "username" @ "IP" identified by "123456"
Username indicates the login user name, and IP indicates the server address for remote login to mysql.