This problem has been around me for several hours. check the problem. Summary: permission issues. So how to authorize? Step 1: stop the service. command line:/etc/init. d/mysqlstop if not, execute the next line: servicemysqldstop report: Stoppingmysqld: [OK] Step 2: Skip password verification and execute the command line: #/usr/bin/mys this problem has been around for several hours. check the problem.
Summary: permission issues. So how to authorize?
Step 1: stop the service
Command line:
/Etc/init. d/mysql stop
If not, execute the following line:
Service mysqld stop
Report:
Stopping mysqld: [OK]
Step 2: Skip password verification
Execute the command line:
#/Usr/bin/mysqld_safe -- skip-grant-tables
Report:
151104 09:07:56 mysqld_safe Logging to '/var/lib/mysql/iZ23dq2wm0jZ. err '.
151104 09:07:56 mysqld_safe Starting mysqld daemon with databases from/var/lib/mysql
Step 3: log on without a password
Execute the command line:
Mysql-u root
Step 4: authorize
Mysql> grant all privileges on *. * to 'root' @ 'localhost' identified by 'root' with grant option;
Key words:
Root '@ 'localhost: User
Root: password
Problem 1: no authorized write permission is found without a password
The MySQL server is running with the -- skip-grant-tables option so it cannot execute this statement
Solution:
Mysql> set global read_only = 0; // (disable the read-only attribute of the new master database)
Mysql> flush privileges;
Mysql> set global read_only = 1; // (read/write attribute)
Mysql> flush privileges; (note that refresh is required)
Step 5: Restart the database
Service mysqld stop
Report:
Stopping mysqld: [OK]
Service mysqld start
Report:
Starting mysqld: [OK]
Or
Service mysqld restart