Official information: dev.mysql.comdocrefman5.0enresetting-permissions.html # resetting-permissions-unix also has a reference to mysql installation, with python-mysql installation blog hearrain. com201101498 according to the official documentation, Forexample, ifyouruntheserverusin
Official information: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix also has a reference to mysql installation, with python-mysql installation blog http://hearrain.com/2011/01/498 according to the official documentation, For example, if you run the server usin
Official: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix
There is also a reference for 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, 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.
After installing mysql, if you use root to log on, you must add -- user = mysql. Otherwise, the server will automatically create the root-owned file, these will cause permission issues.
I used to log on directly, and the root password has no permission to modify.
The solution is
shell> kill `cat /mysql-data-directory/host_name.pid`
The mysql-data-directory path is generally a file with a pid ending with your computer name under/usr/local/mysql/data.
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';FLUSH PRIVILEGES;
After the process ends, put the preceding two sentences in a file, for example, update_passwd. The file is under/usr/local /.
shell> mysqld_safe --init-file=/home/me/mysql-init &
Then sudo su enters the root permission, enters the bin of mysql, and enters the preceding command. After the command is completed (if my command is not completed, another terminal is enabled ),
Go to the mysql Command Line
UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
-> WHERE User='root';
Then, it will be OK.