mac下修改mysql-root密码-各种权限问题解决
2014-07-27 23:25
861 查看
官方资料: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,否则的话,服务器会自动创建root-owned文件,这些就会导致权限的问题
我之前就是因为直接登录了,然后root密码无修改权限,各种无权限
解决的办法就是
mysql-data-directory 的路径一般是 /usr/local/mysql/data下的包含你的电脑名称的以pid结尾的文件
结束进程之后,把上面的两句话放到一个文件中例如update_passwd,该文件在/usr/local/下
然后sudo su进入root权限,进入mysql下bin输入以上命令,结束后(我的好像没有结束,就另开了一个terminal),
进入mysql命令行下
->
然后再进入就ok了
还有一个值得参考的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,否则的话,服务器会自动创建root-owned文件,这些就会导致权限的问题
我之前就是因为直接登录了,然后root密码无修改权限,各种无权限
解决的办法就是
shell> [code]kill `cat /mysql-data-directory/host_name.pid`[/code]
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> [code]mysqld_safe --init-file=/home/me/mysql-init &[/code]
然后sudo su进入root权限,进入mysql下bin输入以上命令,结束后(我的好像没有结束,就另开了一个terminal),
进入mysql命令行下
UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
->
WHERE User='root';[/code]
然后再进入就ok了
相关文章推荐
- MySQL修改root用户密码引起的root超级权限丢失的问题(Mac平台
- mysql 无权限修改user 【修改root密码问题】
- MySQL,如何修改root帐户密码、如何解决root帐户忘记密码的问题
- mac在变化mysql-rootpassword-各种解决问题的能力
- mac上安装mysql 以及root密码忘记或权限错误的解决办法
- MySQL,如何修改root帐户密码、如何解决root帐户忘记密码的问题
- mysql 重新修改密码 以及ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)问题解决
- MySQL,如何修改root帐户密码、如何解决root帐户忘记密码的问题
- 解决mysql手动修改root密码连接不了的问题。
- MySQL修改root密码的各种方法整理
- MySQL修改root密码的各种方法整理
- ubuntu mysql 修改root密码和权限
- MySQL修改root密码的各种方法整理
- 遇到问题---mysql账户密码以及权限的问题 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor
- MySQL修改root密码的各种方法整理
- 简化mysql –uroot –p登录 linux忘记mysql密码处理方法 解决root没有权限
- ubuntu mysql 修改root密码和权限
- Mysql的Root密码忘记,查看或修改的解决方法(图文介绍)
- MySql安装root用户密码设置失败问题解决
- mac 配置mysql命令,修改root密码,启动项等