How to solve mysqly problems in Linux

Source: Internet
Author: User

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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.