After loading the database to clean up some default account, accidentally deleted root, flush privileges after the new root forgot grant any permissions, see mysqld options inside a −−skip-grant-tables
The
code is as follows:
#/usr/libexec/mysqld--verbos--help
The mysql5.5 manual describes the following
The
code is as follows:
--skip-grant-tables
This option causes the ' server to start without using the ' privilege system at all ', which gives anyone with access to the SE RVer unrestricted access to all databases. Can cause a running server to start using the "Grant tables again by executing mysqladmin flush-privileges or MYSQLADMI N Reload command from a system shell, or by issuing a MySQL FLUSH privileges statement after connecting to the server. This option also suppresses loading of plugins, user-defined functions (UDFs), and scheduled events. To cause plugins to is loaded anyway, use the--plugin-load option.
--skip-grant-tables is unavailable if MySQL be configured with the--disable-grant-options option. 2.10.2, "Typical Configure Options".
Mysqld_safe is a startup script for the MySQL server under the Unix/linux system. This script adds some security features that will continue to monitor its operation after the MySQL server is started and reboot the server when there is an error. Background to start MySQL
The
code is as follows:
#mysqld_safe--skip-grant-tables &
If you don't have a root account, add a
The
code is as follows:
INSERT into user SET user= ' root ', host= ' localhost ', ssl_cipher= ', x509_issuer= ', x509_subject= ';
Directly enter the MySQL connection and add permissions, you cannot use the grant command, you can only use the update
The
code is as follows:
UPDATE user SET select_priv= ' y ', insert_priv= ' y ', update_priv= ' y ', delete_priv= ' y ', create_priv= ' y ', drop_priv= ' y ', reload_priv= ' y ', shutdown_priv= ' y ', process_priv= ' y ', file_priv= ' y ', grant_priv= ' y ', references_priv= ' y ', Index_priv = ' y ', alter_priv= ' y ', show_db_priv= ' y ', super_priv= ' y ', create_tmp_table_priv= ' y ', lock_tables_priv= ' y ', execute_ priv= ' y ', repl_slave_priv= ' y ', repl_client_priv= ' y ', create_view_priv= ' y ', show_view_priv= ' y ', create_routine_priv= ' Y ', alter_routine_priv= ' y ', create_user_priv= ' y ', event_priv= ' y ', trigger_priv= ' y ', create_tablespace_priv= ' y ', authentication_string= ' WHERE user= ' root ';
Note that I use MySQL is version 5.5, may be operating in the SQL statements or other places have different, after the execution of the statement needs flush privileges, you may want to log in again.