Installing MySQL on CentOS throws error that cannot find mysqld.sock











up vote
1
down vote

favorite












I have yum install mysql in CentOS 6.4. Now, when I use mysql command, it throws the following error:



ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'


When I check the directory there is no mysql folder. How should I solve this problem? It's worth mentioning when I do service mysql start (or with mysqld) it errors unrecognized service.



I should mention that I have changed the path in my.cnf but nothing happens. The problem is that no *.sock file exists at all.



Update:



Results of checking mysql process with mysqladmin -u root -p status returns:



mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!


Also when I directly want to run /etc/init.d/mysqld it errors that it cannot resolve the ip (localhost.localdomain).



Second Update:



I have run the command [root@localhost /]# rpm -qa | grep mysql



and it returns:



mysql-libs-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.i686
mysql-5.1.73-3.el6_5.x86_64
mysql-server-5.1.73-3.el6_5.i686









share|improve this question
















bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2




    Did you start the mysql process? Is it running?
    – Sree
    Jan 4 '15 at 9:22










  • Have you tried changing path from "/var/run/..." to /var/lib/..." in my.cnf? Also, run ps aux | grep mysql
    – kirill-a
    Jan 4 '15 at 10:20










  • Check if you have this line in /etc/hosts 127.0.0.1 localhost.localdomain
    – Boban P.
    Mar 23 '16 at 7:38










  • and give us a my.cnf
    – Boban P.
    Mar 23 '16 at 7:39















up vote
1
down vote

favorite












I have yum install mysql in CentOS 6.4. Now, when I use mysql command, it throws the following error:



ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'


When I check the directory there is no mysql folder. How should I solve this problem? It's worth mentioning when I do service mysql start (or with mysqld) it errors unrecognized service.



I should mention that I have changed the path in my.cnf but nothing happens. The problem is that no *.sock file exists at all.



Update:



Results of checking mysql process with mysqladmin -u root -p status returns:



mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!


Also when I directly want to run /etc/init.d/mysqld it errors that it cannot resolve the ip (localhost.localdomain).



Second Update:



I have run the command [root@localhost /]# rpm -qa | grep mysql



and it returns:



mysql-libs-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.i686
mysql-5.1.73-3.el6_5.x86_64
mysql-server-5.1.73-3.el6_5.i686









share|improve this question
















bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2




    Did you start the mysql process? Is it running?
    – Sree
    Jan 4 '15 at 9:22










  • Have you tried changing path from "/var/run/..." to /var/lib/..." in my.cnf? Also, run ps aux | grep mysql
    – kirill-a
    Jan 4 '15 at 10:20










  • Check if you have this line in /etc/hosts 127.0.0.1 localhost.localdomain
    – Boban P.
    Mar 23 '16 at 7:38










  • and give us a my.cnf
    – Boban P.
    Mar 23 '16 at 7:39













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have yum install mysql in CentOS 6.4. Now, when I use mysql command, it throws the following error:



ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'


When I check the directory there is no mysql folder. How should I solve this problem? It's worth mentioning when I do service mysql start (or with mysqld) it errors unrecognized service.



I should mention that I have changed the path in my.cnf but nothing happens. The problem is that no *.sock file exists at all.



Update:



Results of checking mysql process with mysqladmin -u root -p status returns:



mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!


Also when I directly want to run /etc/init.d/mysqld it errors that it cannot resolve the ip (localhost.localdomain).



Second Update:



I have run the command [root@localhost /]# rpm -qa | grep mysql



and it returns:



mysql-libs-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.i686
mysql-5.1.73-3.el6_5.x86_64
mysql-server-5.1.73-3.el6_5.i686









share|improve this question















I have yum install mysql in CentOS 6.4. Now, when I use mysql command, it throws the following error:



ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'


When I check the directory there is no mysql folder. How should I solve this problem? It's worth mentioning when I do service mysql start (or with mysqld) it errors unrecognized service.



I should mention that I have changed the path in my.cnf but nothing happens. The problem is that no *.sock file exists at all.



Update:



Results of checking mysql process with mysqladmin -u root -p status returns:



mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!


Also when I directly want to run /etc/init.d/mysqld it errors that it cannot resolve the ip (localhost.localdomain).



Second Update:



I have run the command [root@localhost /]# rpm -qa | grep mysql



and it returns:



mysql-libs-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.i686
mysql-5.1.73-3.el6_5.x86_64
mysql-server-5.1.73-3.el6_5.i686






centos rhel software-installation mysql services






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 4 '15 at 11:19

























asked Jan 4 '15 at 7:35









Mostafa Talebi

13028




13028





bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 2




    Did you start the mysql process? Is it running?
    – Sree
    Jan 4 '15 at 9:22










  • Have you tried changing path from "/var/run/..." to /var/lib/..." in my.cnf? Also, run ps aux | grep mysql
    – kirill-a
    Jan 4 '15 at 10:20










  • Check if you have this line in /etc/hosts 127.0.0.1 localhost.localdomain
    – Boban P.
    Mar 23 '16 at 7:38










  • and give us a my.cnf
    – Boban P.
    Mar 23 '16 at 7:39














  • 2




    Did you start the mysql process? Is it running?
    – Sree
    Jan 4 '15 at 9:22










  • Have you tried changing path from "/var/run/..." to /var/lib/..." in my.cnf? Also, run ps aux | grep mysql
    – kirill-a
    Jan 4 '15 at 10:20










  • Check if you have this line in /etc/hosts 127.0.0.1 localhost.localdomain
    – Boban P.
    Mar 23 '16 at 7:38










  • and give us a my.cnf
    – Boban P.
    Mar 23 '16 at 7:39








2




2




Did you start the mysql process? Is it running?
– Sree
Jan 4 '15 at 9:22




Did you start the mysql process? Is it running?
– Sree
Jan 4 '15 at 9:22












Have you tried changing path from "/var/run/..." to /var/lib/..." in my.cnf? Also, run ps aux | grep mysql
– kirill-a
Jan 4 '15 at 10:20




Have you tried changing path from "/var/run/..." to /var/lib/..." in my.cnf? Also, run ps aux | grep mysql
– kirill-a
Jan 4 '15 at 10:20












Check if you have this line in /etc/hosts 127.0.0.1 localhost.localdomain
– Boban P.
Mar 23 '16 at 7:38




Check if you have this line in /etc/hosts 127.0.0.1 localhost.localdomain
– Boban P.
Mar 23 '16 at 7:38












and give us a my.cnf
– Boban P.
Mar 23 '16 at 7:39




and give us a my.cnf
– Boban P.
Mar 23 '16 at 7:39










2 Answers
2






active

oldest

votes

















up vote
0
down vote













If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with



socket=/var/lib/mysql/mysql.sock



you can check if mysql is running with the following command:



mysqladmin -u root -p status



try changing your permission to mysql folder. If you are working locally, you can try:



sudo chmod -R 755 /var/lib/mysql/



source






share|improve this answer























  • please see the question is updated
    – Mostafa Talebi
    Jan 4 '15 at 10:19










  • And it's worth I'm root user. No need for chmod
    – Mostafa Talebi
    Jan 4 '15 at 10:20


















up vote
0
down vote













Looks like you just installed MySQL client not the server. Use the command below to install the server yum install mysql-server



Also you can refer the link for more information:- MySQL






share|improve this answer





















  • I have installed it. Look at my updated question. Thanks you
    – Mostafa Talebi
    Jan 4 '15 at 11:18










  • check the binding of MySQL using the command lsof -i:3306 may be it's not listening on localhost
    – Karthik
    Jan 4 '15 at 17:47













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f177316%2finstalling-mysql-on-centos-throws-error-that-cannot-find-mysqld-sock%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with



socket=/var/lib/mysql/mysql.sock



you can check if mysql is running with the following command:



mysqladmin -u root -p status



try changing your permission to mysql folder. If you are working locally, you can try:



sudo chmod -R 755 /var/lib/mysql/



source






share|improve this answer























  • please see the question is updated
    – Mostafa Talebi
    Jan 4 '15 at 10:19










  • And it's worth I'm root user. No need for chmod
    – Mostafa Talebi
    Jan 4 '15 at 10:20















up vote
0
down vote













If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with



socket=/var/lib/mysql/mysql.sock



you can check if mysql is running with the following command:



mysqladmin -u root -p status



try changing your permission to mysql folder. If you are working locally, you can try:



sudo chmod -R 755 /var/lib/mysql/



source






share|improve this answer























  • please see the question is updated
    – Mostafa Talebi
    Jan 4 '15 at 10:19










  • And it's worth I'm root user. No need for chmod
    – Mostafa Talebi
    Jan 4 '15 at 10:20













up vote
0
down vote










up vote
0
down vote









If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with



socket=/var/lib/mysql/mysql.sock



you can check if mysql is running with the following command:



mysqladmin -u root -p status



try changing your permission to mysql folder. If you are working locally, you can try:



sudo chmod -R 755 /var/lib/mysql/



source






share|improve this answer














If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with



socket=/var/lib/mysql/mysql.sock



you can check if mysql is running with the following command:



mysqladmin -u root -p status



try changing your permission to mysql folder. If you are working locally, you can try:



sudo chmod -R 755 /var/lib/mysql/



source







share|improve this answer














share|improve this answer



share|improve this answer








edited May 23 '17 at 11:33









Community

1




1










answered Jan 4 '15 at 9:09









kirill-a

2,1101921




2,1101921












  • please see the question is updated
    – Mostafa Talebi
    Jan 4 '15 at 10:19










  • And it's worth I'm root user. No need for chmod
    – Mostafa Talebi
    Jan 4 '15 at 10:20


















  • please see the question is updated
    – Mostafa Talebi
    Jan 4 '15 at 10:19










  • And it's worth I'm root user. No need for chmod
    – Mostafa Talebi
    Jan 4 '15 at 10:20
















please see the question is updated
– Mostafa Talebi
Jan 4 '15 at 10:19




please see the question is updated
– Mostafa Talebi
Jan 4 '15 at 10:19












And it's worth I'm root user. No need for chmod
– Mostafa Talebi
Jan 4 '15 at 10:20




And it's worth I'm root user. No need for chmod
– Mostafa Talebi
Jan 4 '15 at 10:20












up vote
0
down vote













Looks like you just installed MySQL client not the server. Use the command below to install the server yum install mysql-server



Also you can refer the link for more information:- MySQL






share|improve this answer





















  • I have installed it. Look at my updated question. Thanks you
    – Mostafa Talebi
    Jan 4 '15 at 11:18










  • check the binding of MySQL using the command lsof -i:3306 may be it's not listening on localhost
    – Karthik
    Jan 4 '15 at 17:47

















up vote
0
down vote













Looks like you just installed MySQL client not the server. Use the command below to install the server yum install mysql-server



Also you can refer the link for more information:- MySQL






share|improve this answer





















  • I have installed it. Look at my updated question. Thanks you
    – Mostafa Talebi
    Jan 4 '15 at 11:18










  • check the binding of MySQL using the command lsof -i:3306 may be it's not listening on localhost
    – Karthik
    Jan 4 '15 at 17:47















up vote
0
down vote










up vote
0
down vote









Looks like you just installed MySQL client not the server. Use the command below to install the server yum install mysql-server



Also you can refer the link for more information:- MySQL






share|improve this answer












Looks like you just installed MySQL client not the server. Use the command below to install the server yum install mysql-server



Also you can refer the link for more information:- MySQL







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 4 '15 at 10:30









Karthik

2615




2615












  • I have installed it. Look at my updated question. Thanks you
    – Mostafa Talebi
    Jan 4 '15 at 11:18










  • check the binding of MySQL using the command lsof -i:3306 may be it's not listening on localhost
    – Karthik
    Jan 4 '15 at 17:47




















  • I have installed it. Look at my updated question. Thanks you
    – Mostafa Talebi
    Jan 4 '15 at 11:18










  • check the binding of MySQL using the command lsof -i:3306 may be it's not listening on localhost
    – Karthik
    Jan 4 '15 at 17:47


















I have installed it. Look at my updated question. Thanks you
– Mostafa Talebi
Jan 4 '15 at 11:18




I have installed it. Look at my updated question. Thanks you
– Mostafa Talebi
Jan 4 '15 at 11:18












check the binding of MySQL using the command lsof -i:3306 may be it's not listening on localhost
– Karthik
Jan 4 '15 at 17:47






check the binding of MySQL using the command lsof -i:3306 may be it's not listening on localhost
– Karthik
Jan 4 '15 at 17:47




















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f177316%2finstalling-mysql-on-centos-throws-error-that-cannot-find-mysqld-sock%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Entries order in /etc/network/interfaces

新発田市

Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)