mac下修改 mysql 的密码

Have you forgotten your Mac OS X 'ROOT' password and need to reset it? Follow these 4 simple steps:

  1. Stop the mysqld server. Typically this can be done by from 'System Prefrences' > MySQL > 'Stop MySQL Server'

  2. Start the server in safe mode with privilege bypass
    From a terminal:
    sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

  3. In a new terminal window:
    sudo /usr/local/mysql/bin/mysql -u root
    UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE user='root'
    FLUSH PRIVILEGES
    \q

  4. Stop the mysqld server again and restart it in normal mode.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容