Official data: Http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix
Another value gets the reference to the MySQL device. http://hearrain.com/2011/01/498 with Python-mysql Pack blog
According to official documents.
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, and if you must start mysqld with the--user=mysql option. If you start the server as root without using--user=mysql, the server could create root-owned files in the data directory, such as log files, and these may cause permission-related problems for the future server startups.
Let's say that after MySQL is installed, when you log in with root. Must add--user=mysql, otherwise, the server will voluntarily create the root-owned file, which will lead to the issue of permissions
I have been directly logged in, and then Rootpassword no change permissions, a variety of no permissions
The solution is
kill `cat /mysql-data-directory/host_name.pid`
The path to the mysql-data-directory is usually a PID-terminated file under/usr/local/mysql/data that includes your computer's name.
UPDATE mysql.user SET password=password (' Mynewpass ') WHERE user= ' root '; FLUSH privileges;
After the process is finished, put the above two sentences into a file such as UPDATE_PASSWD, the file under/usr/local/
mysqld_safe --init-file=/home/me/mysql-init &
Then sudo su enters root, enters MySQL under the bin to enter the above command, after the end (I did not seem to end, opened another terminal).
Go to the MySQL command line
UPDATE mysql.user SET Password=PASSWORD(‘MyNewPass‘)
-WHERE User=‘root‘;
And then it's OK to go in again.
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
Mac is changing mysql-rootpassword-ability to solve various problems