在 MAMP/macOS 上恢复 MySQL 的“root”用户和密码
如果您不小心删除了您在 macOS 上的本地 MAMP/MySQL 设置,不必惊慌!这是一个快速但肮脏的解决方案,可以恢复您的访问权限。
首先,您需要一个具有系统管理员权限的管理员帐户。完成后,请按照以下步骤操作:
sudo /Applications/MAMP/Library/bin/mysql.server restart
mysql -u root
DELETE FROM mysql.user WHERE user = 'root' AND host = 'localhost'; INSERT INTO mysql.user SET user = 'root', host = 'localhost', password = Password('your-new-password'), 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';
exit sudo /Applications/MAMP/Library/bin/mysql.server restart
您现在应该已重新获得对 MySQL 数据库的访问权限使用“root”用户和您的新密码。
以上是如何在 MAMP/macOS 上恢复我的 MySQL \'root\' 用户和密码?的详细内容。更多信息请关注PHP中文网其他相关文章!