Can't connect to local MySQL server through socket Solution

Source: Internet
Author: User


Can't connect to local MySQL server through socket solution recently my ubuntu system sudo installed database problems, forced to reinstall, restart and use the mysql Command client to connect, the following message is displayed: Ruby code [LING mysql] $ <span style = ""> mysql-u root-p </span> Enter password: ERROR 2002 (HY000 ): can't connect to local MySQL server through socket '/var/run/mysqld. sock '(2) my. cnf: Python code [mysqld] datadir =/var/lib/mysql <span style = "color: # ff0000; font-size: x-small; "> socket =/var/lib/mysql. sock </span> user = mysql # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package ). old_passwords = 1 www.2cto.com [mysqld_safe] log-error =/var/log/mysqld. log pid-file =/var/run/mysqld. pid port = 3307
Go to/var/lib/mysql and find mysql. sock exists, but there is no mysqld under/var/run/mysqld. sock: A Soft link to use/var/lib/mysql. sock: Shell code [ROOT mysqld] $ <span style = ""> ln-s/var/lib/mysql. sock/var/run/mysqld. sock </span> [ROOT mysqld] $ mysqld_safe -- log-error =/var/lib/mysql/error. log & link and start mysql to view error. log, as follows: Java code www.2cto.com [ROOT mysql] $ <span style = "color: # ff0000;"> more error. log </span> InnoDB: T He log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 100313 10:48:12 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. innoDB: Reading tablespace information from. ibd files... innoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... 100313 10:48:12 InnoDB: Started; log sequence number 0 43655 100313 10:48:12 [Note]/usr/sbin/mysqld: ready for connections. version: '5. 0.51a-3ubuntu5. 5 'socket: '/var/lib/mysql. sock 'port: 3307 (Ubuntu) [ROO T mysql] $ re-link, successful!
 

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.