Just installed linux as 4.
The first problem we face now is how to use mysql> [root @ server tmp] rmp-qa | grep mysql to check the current mysql version.
I:
When I input mysql in the command line, the following error occurs: Can't connect to local MySQL server through socket '/var/lib/mysql. soc.
The solution is as follows: the mysql service has not been started. Try it out: >>> service mysqld starty
II:
Root @ localhost www] # service mysqld start
Initializing MySQL database: Neither host 'localhost' nor 'localhost' could be looked up
/Usr/bin/resolveip
Please configure the 'hostname' command to return a correct hostname.
If you want to solve this at a later stage, restart this script
The -- force option
[FAILED]
[Root @ localhost www] #
Handling:
1. $ ping localhost
Ping: unknown host localhost
Ping fails. It is determined that it may be the cause of localhost resolution.
2. View/etc/hosts as follows:
# Do not remove the following line, or various programs
# That require network functionality will fail.
: 1 localhost. localdomain localhost
3. After: 1 is changed to 127.0.0.1, the startup is successful.
Iii. mysqladmin-u root-p password
I want to enter a blank password, but I can say
Mysqladmin: connect to server at 'localhost' failed
Erroe: 'acces denied for user' root @ 127.0.0.1'
Try this:> mysql-u root-p 123456
Enter password: 123456
Or refer:
Use the methods described on the Internet to change the password of the root user:
# Mysqladmin-uroot-p password 'newpassword'
Enter password:
Mysqladmin: connect to server at 'localhost' failed
Error: 'Access denied for user' root' @ 'localhost' (using password: YES )'
Now I have found the solution as follows (Please test method 3 first, thank you !) :
Method 1:
#/Etc/init. d/mysql stop
# Mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
# Mysql-u root mysql
Mysql> UPDATE user SET Password = PASSWORD ('newpassword') where USER = 'root ';
Mysql> flush privileges;
Mysql> quit
#/Etc/init. d/mysql restart
# Mysql-uroot-p
Enter password: <Enter the new password newpassword>