--1 杀掉你的mysqld进程/etc/init.d/mysqld stop--2 进入mysql的bin目录,以不验证权限的方式启动mysqlcd /usr/local/mysql/bin./mysqld_safe --skip-grant-tables &--3 新起进程登录mysql./mysql--4 尽量别用root账户名,创建admin用户insert into mysql.user set user='admin',ssl_cipher='',host='%',password=password(password), x509_issuer='', x509_subject='';--5 赋予权限update mysql.user set host='%',select_priv='y', insert_priv='y',update_priv='y', alter_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',create_user_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' where user='admin';--6 加载新的权限flush privileges;--7 杀掉 safe 模式的mysql进程killall mysqld--8 启动mysql/etc/init.d/mysqld start