Official information: Http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix
There is also a reference to MySQL installation, with Python-mysql installation blog http://hearrain.com/2011/01/498
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.
If after the installation of MySQL, when you log in with root, you must add--user=mysql, otherwise, the server will automatically create root-owned files, which will lead to permissions issues
I was just logged in, and then the root password without modification permissions, a variety of no permissions
The solution is
kill `cat /mysql-data-directory/host_name.pid`
The path to Mysql-data-directory is typically a PID-terminated file under/usr/local/mysql/data that contains 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 permission, enters MySQL under the bin to enter the above command, after the end (I do 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.