VMware載入其他宿主機上的虛擬機器以後,mySQL沒法啟動。如何解決?

來源:互聯網
上載者:User

標籤:rect   com   ram   perl   nbsp   x86   div   cti   解決   

IP地址已經修改過來,與宿主機在一個網段(Bridge模式)。但是,MySQL無法串連上。

[[email protected] ~]# mysql
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2)

[[email protected] ~]# ps -A | grep -i mysql
[[email protected] ~]# service mysql start
Redirecting to /bin/systemctl start mysql.service
Failed to start mysql.service: Unit not found.

[[email protected] ~]# ps -ef|grep mysql
root 4560 4126 0 20:40 pts/0 00:00:00 grep --color=auto mysql

 

[[email protected] ~]# /etc/init.d/mysql start
bash: /etc/init.d/mysql: 沒有那個檔案或目錄

在/etc/rc.d/init.d裡面沒有mysqld,

[[email protected] ~]# /usr/bin/mysqladmin version
/usr/bin/mysqladmin: connect to server at ‘localhost‘ failed
error: ‘Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2)‘
Check that mysqld is running and that the socket: ‘/var/lib/mysql/mysql.sock‘ exists!

[[email protected] ~]# rpm -qa | grep -i mysql
qt5-qtbase-mysql-5.6.1-10.el7.x86_64
qt3-MySQL-3.3.8b-51.el7.x86_64
akonadi-mysql-1.9.2-4.el7.x86_64
perl-DBD-MySQL-4.023-5.el7.x86_64
qt-mysql-4.8.5-13.el7.x86_64
MySQL-python-1.2.5-1.el7.x86_64

 [[email protected] ~]# whereis mysql
mysql: /usr/bin/mysql /usr/lib/mysql /usr/lib64/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz 

 [[email protected] ~]# find / -name mysql.sock

[[email protected] ~]# touch /var/lib/mysql/mysql.sock

[[email protected] ~]# service mysql start
Redirecting to /bin/systemctl start  mysql.service
Failed to start mysql.service: Unit not found.
[[email protected] ~]# systemctl start mysql.service
Failed to start mysql.service: Unit not found.
   [[email protected] ~]# service mysqld status
Redirecting to /bin/systemctl status  mysqld.service
Unit mysqld.service could not be found.
[[email protected] ~]# service mysqld stop
Redirecting to /bin/systemctl stop  mysqld.service
Failed to stop mysqld.service: Unit mysqld.service not loaded.
[[email protected] ~]# rm -fr /var/lib/mysql/*
[[email protected] ~]# rm /var/lock/subsys/mysqld
rm: 無法刪除"/var/lock/subsys/mysqld": 沒有那個檔案或目錄
[[email protected] ~]# killall mysqld 
mysqld: no process found
[[email protected] ~]# service mysql start
Redirecting to /bin/systemctl start  mysql.service
Failed to start mysql.service: Unit not found. 

看了很多文章,實際都不是這個問題。最後這個文章解決了,老外遇到的。還是外國的文章有價值些,內容廣些,原創多。Google很重要。

http://www.cnblogs.com/aleafo/p/4946037.html

# mysql -u root -pEnter password:Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 11Server version: 5.5.37-MariaDB MariaDB ServerCopyright (c) 2000, 2014, Oracle, Monty Program Ab and others.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.MariaDB [(none)]>

So the 3 steps to enable and run MariaDB are as follows, assuming it was previously installed during the initial setup for the system or with yum install mariadb mariadb-server:

systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation

 

VMware載入其他宿主機上的虛擬機器以後,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.