Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
When I try to run mySQL on Fedora 7, it gives me an error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
There is no mysql.sock file on my system.
I have tried to run mysqld start, but that gives me an error:
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
I have searched through the forums, and the only solutions that I have found depend on one of the two commands to work.
I installed mysql, mysql-server and mysql-devel through yum.
Any ideas or suggestions would be greatly appreciated.
When I try to run mySQL on Fedora 7, it gives me an error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
There is no mysql.sock file on my system.
I have tried to run mysqld start, but that gives me an error:
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
I have searched through the forums, and the only solutions that I have found depend on one of the two commands to work.
I installed mysql, mysql-server and mysql-devel through yum.
Any ideas or suggestions would be greatly appreciated.
Who are you running mysqld as? How are you launching mysqld? Does /var/lib/mysql exist? what are the permissions on that directory?
btw, I have a very detailed post on this forum about this error, but it's related to running mysql in user space where I don't have access to /var/lib. Your config is a little different, so let's get started by answering the above questions.
Who are you running mysqld as? How are you launching mysqld? Does /var/lib/mysql exist? what are the permissions on that directory?
btw, I have a very detailed post on this forum about this error, but it's related to running mysql in user space where I don't have access to /var/lib. Your config is a little different, so let's get started by answering the above questions.
I am running mysqld as root, using /etc/rc.d/init.d/mysqld.
/var/lib/mysql DOES exist.
This is the permissions I get using ls -l.
drwxr-xr-x 4 mysql mysql 4096 2007-11-07 13:54 mysql
However, when I go to the folder using the GUI, it says the owner is: mysql - MySQL Server, and it won't let me change any of the options (when I'm running as user).
Hopefully that's detailed enough.
more to the point, does /var/lib/mysql/mysql.sock exist? How are the permissions on it?
Check your my.cnf in both the sections [mysql] and [mysqld] and make sure that they agree on where the socket should be. If they don't, then change the [mysql] section's socket to point to the [mysqld]'s one and try it again.
You might also check the output of "ps aux | grep mysql", looking for the "--socket" argument and making sure it matches what you expect.
more to the point, does /var/lib/mysql/mysql.sock exist? How are the permissions on it?
Check your my.cnf in both the sections [mysql] and [mysqld] and make sure that they agree on where the socket should be. If they don't, then change the [mysql] section's socket to point to the [mysqld]'s one and try it again.
You might also check the output of "ps aux | grep mysql", looking for the "--socket" argument and making sure it matches what you expect.
mysql.sock doesn't exist anywhere on my system.
Code:
ps aux | grep mysql
root 3261 0.0 0.0 4004 708 pts/0 S+ 13:23 0:00 grep mysql
I don't know what you mean by using the "--socket" argument though.
ps aux | grep mysql
root 3261 0.0 0.0 4004 708 pts/0 S+ 13:23 0:00 grep mysql
I don't know what you mean by using the "--socket" argument though.
re: ps aux -
mysqld is not running on your system. The only thing that you are grepping out of the ps is the call to ps itself. A properly running mysqld will have a ps entry looking something like so (though your paths will be different than mine):
though mysqld may not be starting *because* of the socket problem.
When I installed my mysql server by hand, the socket wasn't created until I ran the tests.. This is not to say that it wouldn't have been created by simply starting it, but it is to say that running the tests created the socket file.
to run the test, see if you have a directory called "mysql-test" somewhere on your system. If so, cd to that dir, then run "perl mysql-test-run.pl" (assuming you have perl installed).
Beyond that, double check your my.conf & see that everything looks sane (though it should as you have a vanilla install from yum); then try starting by hand, i.e.:
cd /wherever/mysql/root/is (probably / or /usr)
./bin/mysqld_safe --user=mysql
and see what happens. At least you'll see error messages on the screen this way.
There is no "mysql-test" file on my system, however there is a mysqltest in /usr/bin.
Code:
perl mysqltest -run
Unrecognized character \x7F at mysqltest line 1.
My conf file looks fine as well.
Code:
[root@localhost bin]# mysqld_safe --user=mysql
nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
071108 15:00:25 mysqld ended
There is no "mysql-test" file on my system, however there is a mysqltest in /usr/bin.
Code:
perl mysqltest -run
Unrecognized character \x7F at mysqltest line 1.
weird. can't tell you what that means. If you look at the file (it should just be text) are there any odd chars in it on line 1?
Quote:
My conf file looks fine as well.
Code:
[root@localhost bin]# mysqld_safe --user=mysql
nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
071108 15:00:25 mysqld ended
So from that, it appears that it started then stopped immediately. Did you stop it with cntl-c or did it stop by itself?
Either way, why don't you try specifying a socket when you launch mysqld by hand - just as a test.
mysqld_safe --user=mysql --socket=/tmp/mysql.sock
if it doesn't quit immediately, open another shell then connect with:
mysql --socket=/tmp/mysql.sock
... if you need to specify user/pass, then do:
mysql --socket=/tmp/mysql.sock -uuser -ppass
edit: I'm beginning to wonder if the initial database setup was ever done. is there anything in /var/lib/mysql? if so, what? Go ahead and do that other stuff too (the couple things above), but if that doesn't work, there's another road we can travel.
^?ELF^A^A^A^@^@^@^@^@^@^@^@^@^B^@^C^@^A^@^@^@ðÁ^D^H4^@^@^@4^E^B^@^
There's the first few characters in the file. There is only about 2% that is in normal characters.
I tried the options, however I got the same result.
But the problem is probably that the databases weren't created (as you said).
In /var/lib/mysql, there is a mysql directory and a test directory, however they are both empty.
http://dev.mysql.com/doc/refman/5.0/...tallation.html says that rpm distros run the mysql_install_db command. But if it didn't run (which, if those dirs are empty, it probably didn't run successfully), you might try running it yourself.
The rest of that document should also prove informative, if you run it successfully. It's sort of the "here's the next steps" doc.
http://dev.mysql.com/doc/refman/5.0/...tallation.html says that rpm distros run the mysql_install_db command. But if it didn't run (which, if those dirs are empty, it probably didn't run successfully), you might try running it yourself.
What he said.
... and it also appears that the file you quoted is binary. maybe you just run it as opposed to perling it. Regardless - try to do the initial db setup as described in the docs.
i have installed mysql using yum
yum install mysql
and its not started and when i try to run in terminal iam getting this message
"ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"
Most probably this problem causes as the default database not created properly so try to install default database once again.
mysql_install_db --user=username
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.