The first way:
1. Stop MySQL Services first: Service mysqld stop
2. Add parameter start Mysql:/usr/bin/mysqld_safe--skip-grant-tables &
Then you can access MySQL without any restrictions.
3.root User Login system: Mysql-u root-p MySQL
4. Switch database: Use MySQL
5. Show All tables: show tables;
You can access the table here.
6. View the root user's localhost permissions in the Users table: SELECT * from user where user= ' root ' and host= ' localhost '
7. Shown in the list shown: The root user's localhost permissions are ' N ', indicating that the root user does not have permission to log on locally
8. Modify the root user's localhost permissions:
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 '
where user= ' root ' and host= ' localhost
9. Update: Flush privileges;
10. Then restart the MySQL to solve the problem
The first one does not take the second type of:
Delete the MySQL file in data:
Delete MySQL after execution: .
/scripts/mysql_install_db
--user=mysql --datadir=
/usr/local/mysql/data/mysql
It should be good.
MySQL root user does not see MySQL library problem solving method in Linux