zoukankan      html  css  js  c++  java
  • mac在变化mysql-rootpassword-各种解决问题的能力

    官方数据:http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix

    另值获取引用mysql设备。与python-mysql装博客http://hearrain.com/2011/01/498


    据官方文档说。

    For example, if you run the server using the mysql login account, you should log in as mysql before using the instructions. Alternatively, you can log in as root, but in this case you must start mysqld with the --user=mysql option. If you start the server as root without using --user=mysql, the server may create root-owned files in the data directory, such as log files, and these may cause permission-related problems for future server startups.

    假设在安装完mysql后,当你用root登录的时候。必须加上--user=mysql,否则的话,server会自己主动创建root-owned文件,这些就会导致权限的问题


    我之前就是由于直接登录了,然后rootpassword无改动权限,各种无权限


    解决的办法就是

    shell> kill `cat /mysql-data-directory/host_name.pid`
    mysql-data-directory   的路径通常是 /usr/local/mysql/data下的包括你的电脑名称的以pid结尾的文件


    UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
    FLUSH PRIVILEGES;
    结束进程之后,把上面的两句话放到一个文件里比如update_passwd,该文件在/usr/local/下


    shell> mysqld_safe --init-file=/home/me/mysql-init &

    然后sudo su进入root权限,进入mysql下bin输入以上命令,结束后(我的好像没有结束,就另开了一个terminal)。

    进入mysql命令行下

    UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
        ->                   WHERE User='root';

    然后再进入就ok了





    版权声明:本文博主原创文章,博客,未经同意不得转载。

  • 相关阅读:
    数据结构与算法
    c++学习笔记
    红黑树(map与unorder_map)B B+树
    数据库笔记
    多路复用IO:select poll epoll
    https加密过程!!! 这才是差不多非常详细的https双方获取共用的秘钥过程!!!!!
    助教周报(第一轮)——范青青
    第二十二周助教总结(2021.6.28-7.4)
    第二十一周助教总结(2021.6.21-6.27)
    第二十周助教总结(2021.6.14-6.20)
  • 原文地址:https://www.cnblogs.com/yxwkf/p/4854703.html
Copyright © 2011-2022 走看看