MySQL Study Case--mysql Client connection failure

Source: Internet
Author: User
Tags mysql client

MySQL Study Case--mysql Client connection failure


System Environment :

Operating system: RedHat EL6

DB Soft:mysql 5.6.4-M7

The system installed the source package MySQL 5.6.4-M7 version, after starting the service, the client connection failed!


[[EMAIL PROTECTED] ~]# CD /USR/LOCAL/MYSQL/[[EMAIL PROTECTED] MYSQL]# CD  bin[[email protected] bin]# ./mysql -u root -pEnter password:  error 2002  (HY000):  can ' T connect to local mysql server through  socket  '/tmp/mysql.sock '   (13)--Connection server failed [[Email protected] bin]# mysql -u  root -pEnter password: Welcome to the MySQL monitor.   commands end with ; or \g.your mysql connection id is  2server version: 5.1.66 source distributioncopyright  (c)  2000, 2012,  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>

--connected to the 5.1.66 version of the system itself


Workaround:

View the configuration file and modify

[Email protected] bin]# cat/etc/my.cnf[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0[mysqld_safe]log-error=/var/ Log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid changing the socket parameter: [[email protected] bin]# Vi/etc/my.cnf[mysqld]datadir =/var/lib/mysqlsocket=/tmp/mysql.sock#socket=/var/lib/mysql/mysql.sockuser=mysql# Disabling Symbolic-links is Recommended to prevent assorted security riskssymbolic-links=0[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/ var/run/mysqld/mysqld.pid~

Verify:

Stop the MYSQLD process:[[email protected] bin]# ps -ef |grep mysqlroot       4482  4456  0 12:27 pts/3    00:00:00  /bin/sh /usr/bin/mysqld_safe --user=mysqlmysql     4553   4482  0 12:27 pts/3    00:00:00 /usr/libexec/mysqld -- basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log -- pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sockroot       4590  4456  1 12:29 pts/3    00:00:00 grep  mysql[[email protected] bin]# pkill mysql[[email protected] bin]# ps - ef |grep mysql150206 12:30:03 mysqld_safe mysqld from pid file / Var/run/mysqld/mysqld.pid endedroot      4597  4456  0 12:30 pts/3     00:00:00 grep mysql[1]+  Done                     mysqld_safe --user=mysql    (wd: ~) (Wd now: /usr/local/mysql/bin) [[Email protected] bin]# ps -ef  |grep mysqlroot      4599  4456  0 12:30  pts/3    00:00:00 grep mysql restarting the MYSQLD process: [[Email protected] bin] # ./mysqld_safe &[1] 4602[[email protected] bin]# 150206 12:30:17  mysqld_safe logging to  '/var/log/mysqld.log ' .150206 12:30:18 mysqld_safe  Starting mysqld daemon with databases from /var/lib/mysql Client Connection Successful:[[email  protected] bin]# ./mYsql -u root -penter password: welcome to the mysql monitor.   commands end with ; or \g.your mysql connection id is  1Server version: 5.6.4-m7 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>mysql> status--------------./mysql  ver 14.14 distrib  5.6.4-m7, for Linux  (x86_64)  using  EditLine wrapperConnection  id:          3current database:current user:            [email protected]SSL:                     not in usecurrent pager :          stdoutusing outfile:            ' using delimiter:        ; server version:         5.6.4-m7 source  distributionprotocol version:       10connection:              localhost via unix socketserver  characterset:    latin1Db     characterset:     latin1client charactErset:    utf8conn.  characterset:    utf8unix socket:             /tmp/mysql.sockUptime:                  26 min 33  secthreads: 1  questions: 6  slow queries: 0  opens:  66  flush tables: 1  open tables: 59  queries per  second avg: 0.003--------------mysql>


@ so far, problem solved

This article is from the "Tianya blog," Please make sure to keep this source http://tiany.blog.51cto.com/513694/1612401

MySQL Study Case--mysql Client connection failure

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.