Home > Database > Mysql Tutorial > mac下修改mysql

mac下修改mysql

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:39:49
Original
1216 people have browsed it

官方资料: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 usin

官方资料: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.
Copy after login

如果在安装完mysql后,当你用root登录的时候,必须加上--user=mysql,否则的话,服务器会自动创建root-owned文件,这些就会导致权限的问题


我之前就是因为直接登录了,然后root密码无修改权限,各种无权限


解决的办法就是

shell> <span><code>kill `cat /mysql-data-directory/host_name.pid`</code></span>
Copy after login
mysql-data-directory   的路径一般是 /usr/local/mysql/data下的包含你的电脑名称的以pid结尾的文件


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


shell> <span><code>mysqld_safe --init-file=/home/me/mysql-init &</code></span>
Copy after login

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

进入mysql命令行下

<span><code>UPDATE mysql.user SET Password=PASSWORD('MyNewPass')</code></span>
    ->                   <span><code>WHERE User='root';</code></span>
Copy after login

然后再进入就ok了





Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
mac use
From 1970-01-01 08:00:00
0
0
0
How to install it on Mac?
From 1970-01-01 08:00:00
0
0
0
Why doesn’t Mac have PHPstudy?
From 1970-01-01 08:00:00
0
0
0
When will phpstudy release a mac version?
From 1970-01-01 08:00:00
0
0
0
Where is the telnet option on mac computer?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template