第一步是關閉的MySQL,然後顯示撥款重新連接禁用:試圖修復MySQL的root用戶權限
/Applications/MAMP/Library/bin/mysqld --skip-grant-tables
--skip-networking --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock &
從那裏我連接到MySQL沒有用戶/密碼,就去固定的授予權限:
UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
所以現在我mysql.user行的樣子:
+-----------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+
| Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string |
+-----------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+
| localhost | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | |
+-----------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+
然後我關閉mysql和重啓都授權表選項等:
/Applications/MAMP/Library/bin/mysqld --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock &
然後我用root用戶名和密碼重新連接,並再次給予自己的權限來我所有的本地數據庫:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'
仍然沒有運氣。
mysql> SELECT * FROM exp_throttle LIMIT 1;
ERROR 1142 (42000): SELECT command denied to user 'root'@'localhost' for table 'exp_throttle'
我是否缺少明顯的東西?
謝謝瑞恩,我已經閱讀並嘗試過。我甚至無法卸載/重新安裝mysql,因爲我無法獲取數據庫。 – JamesNZ
我放棄了並從我的系統中完全卸載/重新安裝了MAMP Pro,甚至在此之後,root用戶仍然無法做任何事情(即創建一個新的數據庫)。 – JamesNZ