When I remotely access the MySQL database on the server , it is found that root cannot be connected remotely, and an error is displayed: "1045-Access denied for user root@..."
The solution is as follows, execute the command: mysql> select host,user from mysql.user;
Add the record with host as %, you can realize the access of any IP (it can also be specified as a fixed IP).
After modification, refresh the permissions.
mysql> flushprivileges;
Attached are the descriptions of the permissions:
List | illustrate |
Select_priv | Determines whether the user can select data via the SELECT command |
Insert_priv | Determine if user can insert data via INSERT command |
Update_priv | Determine if user can modify existing data via UPDATE command |
Delete_priv | Determine if user can delete existing data via DELETE command |
Create_priv | Determine if a user can create new databases and tables |
Drop_priv | Determine if a user can drop existing databases and tables |
Reload_priv | Determines whether a user can execute specific commands that flush and reload various internal caches used by MySQL, including logs, permissions, hosts, queries, and tables |
Shutdown_priv | Determines whether the user can shut down the MySQL server. Great care should be taken when giving this privilege to any user other than the root account |
Process_priv | Determine if a user can view other users' processes with the SHOW PROCESSLIST command |
File_priv | Determine if user can execute SELECT INTO OUTFILE and LOAD DATA INFILE commands |
grant_priv | Determines whether a user can grant permissions already granted to the user to other users |
References_priv | Currently just a placeholder for some future functionality; has no effect now |
Index_priv | Determine whether users can create and drop table indexes |
age_priv | Determine if user can rename and modify table structure |
Show_db_priv | Determines whether the user can view the names of all databases on the server, including databases for which the user has sufficient access rights |
Super_priv | Determines whether a user can perform some powerful administrative functions, such as deleting user processes via the KILL command, modifying global MySQL variables with SET GLOBAL, executing various commands regarding replication and logging |
Create_tmp_table_priv | Determine if user can create temporary table |
Lock_tables_priv | Determines if a user can block access/modification to a table using the LOCK TABLES command |
Execute_priv | Determine if a user can execute a stored procedure |
Repl_slave_priv | Determines whether users can read the binary log files used to maintain the replicated database environment. This user is located on the main system and facilitates communication between the host and client |
Repl_client_priv | Determine if the user can determine the location of the replication slave and master |
Create_view_priv | Determine if a user can create a view |
Show_view_priv | Determine if the user can view the view or understand how the view performs |
Create_routine_priv | Determine if the user can change or discard stored procedures and functions |
Alter_routine_priv | Determines whether users can modify or delete stored functions and functions |
Create_user_priv | Determines whether a user can execute the CREATE USER command, which is used to create a new MySQL account |
Event_priv | Determines whether users can create, modify, and delete events |
Trigger_priv | Determines whether users can create and delete triggers |