MySQL Study案例之--MySQL用戶端串連故障

來源:互聯網
上載者:User

標籤:mysql

MySQL Study案例之--MySQL用戶端串連故障


系統內容

作業系統:RedHat EL6

DB Soft:  MySQL 5.6.4-m7

    在系統安裝了源碼包 MySQL 5.6.4-m7版本,啟動服務後,用戶端串連失敗 !


[[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)--串連server失敗[[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>

--連入了系統內建的5.1.66的版本


解決方案:

查看設定檔,並修改

[[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更改socket參數:[[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~

驗證:

停止mysqld進程:[[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重新啟動mysqld進程:[[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用戶端串連成功:[[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>


@至此,問題解決

本文出自 “天涯客的blog” 部落格,請務必保留此出處http://tiany.blog.51cto.com/513694/1612401

MySQL Study案例之--MySQL用戶端串連故障

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.