Yesterday morning, at the end of the video "MySQL multi-instance Installation guide for L10-008-lamp Environment", there was a problem again.
The night before yesterday, according to the video tutorial after cleaning up the redundant MySQL database account, the direct exit of the database and shut down (not after clearing the account, exit the database and re-login to the database-in fact, there is no need to do such a test). Opened the virtual machine yesterday morning and thought about completing the last part of the video. Unexpectedly, in the use of passwords to log on to 3306 instances, no matter how to log in.
[Email protected] 3306]# mysql-uroot-p-s/data/3306/mysql.sockenter password:error 1045 (28000): Access denied for us Er ' root ' @ ' localhost ' (using password:yes) [[email protected] 3306]# mysql-uroot-p ' oldboy3306 '-s/data/3306/mysql.sock ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)
Baidu Search this error message related content, or lead me astray. The correct solution was not found through the error log.
A lot of information is reset password, this method in Oldboy "L10-002-mysql common basic commands-view Help and Change Password 02" video also said. However, all aspects of the information are for the single-instance case of the reset password.
Nothing to do, had to send this issue to QQ Group. There is no news in the morning, I try to ask QQ group again in the afternoon, finally have a classmate reply me 1 multi-instance Reset password command. This way, I can use the reset password to try to log in to the database.
However, after the password change, the issue of login error is still not resolved. It seems that this time the problem is not related to the password.
Here, the multi-instance reset password operation is sorted out for future needs.
If you forget to log in to the multi-instance database, you need to log in to the database using the "Ignore authorization table" parameter. However, the commands are slightly different from the commands used by a single instance.
[[email protected] ~]# netstat -lnt|grep 330tcp 0 0 0.0.0.0:3306 0.0.0.0:* listen[[email protected] ~]# killall mysqld[[email protected] ~]# killall mysqld[[email protected] ~]# killall mysqldmysqld: no process killed[[email protected] ~]# mysqld_safe --defaults-file=/data/3306/my.cnf --skip-grant-table &[1] 6015140607 15:11:58 mysqld_safe Logging to '/data/3306/mysql_oldboy3306.err ' .140607 15:11:59 mysqld_safe starting mysqld daemon with databases from /data/ 3306/data[[email protected] ~]# netstat -lnt|grep 330tcp 0 0 0.0.0.0:3306 0.0.0.0:* listen
Logon to a multi-instance database does not require password validation:
[[Email protected] ~]# mysql -uroot -s /data/3306/mysql.sockwelcome to the MySQL monitor. Commands end with ; or \g.Your mysql connection id is 1server version: 5.1.62-log source distributioncopyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. oracle is a registered trademark of oracle corporation and/or Itsaffiliates. other names may be trademarks of their respectiveowners . type ' help; ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> show databases;+--------------------+| database |+--------------------+| information_schema | | mysql | | oldboy3306 | | test |+-------- ------------+4 rows in set (0.03 sec) Mysql> select user,host,password from mysql.user;+------+-----------+-------------------------------------------+| user | host | password |+------+-----------+----------------------------------------- --+| root | web | * 007ffca4271ee782cbee4db65344c906c10915bb | | root | 127.0.0.1 | *007ffca4271ee782cbee4db65344c906c10915bb |+------+-----------+-------------------------------------------+ 2 rows in set (0.00 sec) Mysql> quitbye