mysql5.5手册说明如下 复制代码 代码如下: --skip-grant-tables This option causes the server to start without using the privilege system at all, which gives anyone with access to the server unrestricted access to all databases. You can cause a running server to start using the grant tables again by executing mysqladmin flush-privileges or mysqladmin 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 be loaded anyway, use the --plugin-load option. --skip-grant-tables is unavailable if MySQL was configured with the --disable-grant-options option. See Section 2.10.2, “Typical configure Options”.
如果没有root账户就添加一个 复制代码 代码如下: INSERT INTO user SET User="root",Host="localhost",ssl_cipher="",x509_issuer="",x509_subject="";
直接输入mysql连接并添加权限,这时候是不能使用grant命令的,只能用update 复制代码 代码如下: 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";