How to deal with MySQL connection error 1317?
MySQL is a very popular relational database management system that is widely used in various web applications and servers. However, when using MySQL, you sometimes encounter various errors, one of which is "Connection Error 1317". This article will introduce how to handle this error so that users can use MySQL more smoothly.
MySQL connection error 1317 refers to an error that occurs when trying to create a new user or change the password of an existing user. When this error occurs, the system will prompt "Query execution was interrupted" or "Query execution was interrupted, max_statement_time exceeded", causing the connection to fail to be successfully established. This error usually occurs when executing the following commands: CREATE USER, ALTER USER, or SET PASSWORD.
To solve connection error 1317, you can try the following methods:
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Save the file and restart the MySQL service. This will disable strict mode, fixing an issue that caused connection error 1317 in some cases.
sudo service mysql restart
or
sudo systemctl restart mysql
This will restart Start the MySQL service, clear the temporary problem and restore normal connections.
mysql -u root -p
Then enter the MySQL root password. This will open the MySQL command line interface, where user and password related commands can be executed without encountering connection error 1317.
mysql -u root -p
Then enter the MySQL root password. Next, execute the following command to create a new user or change the password:
CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'password';
(Replace 'new_user' and 'new_user' with your new username and password 'password')
ALTER USER 'user'@'localhost' IDENTIFIED BY 'new_password';
(Replace 'user' and 'new_password' with the username and new password to be modified)
This will use root user privileges to perform relevant operations, thus solving connection error 1317.
To sum up, MySQL connection error 1317 is a common problem, but it can be easily solved with appropriate methods and techniques. Choose the appropriate method based on the situation, and back up your database as needed to prevent data loss. At the same time, MySQL and related software are regularly updated to ensure system security and stable operation.
The above is the detailed content of How to deal with MySQL connection error 1317?. For more information, please follow other related articles on the PHP Chinese website!