PDA

View Full Version : Setting up MySQL server


Ghroth
2008-09-01, 02:59 AM CDT
Hi there. First of all i would like to introduce myself since this is my very first post.
My name is Jim and i'm from Greece. AND i'm pretty new to the linux. I chose to install FC9. servering httpd, php and mysql. So far, i had no problem with http and php but i'm having troubles with mysql.
Here it goes:

i've installed mysql.i386 (5.0.51a-1.fc9.i386.rpm) and mysql-server.i386 (5.0.51a-1.fc9) via yum with all their dependencies.: When i try to run the service, ("mysql start") i get the error:
[root@localhost /]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Searching a little bit deeper i found that this error's coming from /etc/my.cnf:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql.sock
user=mysql
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Further more i found that the file "mysql.sock" is generated automatically when mysqld is starting but still no results from "find -name mysql.sock". And yup i can see the service mysqld running.

Sorry if this problem is kinda "newbie" to you. Any kind of help would be really appreciated.
Thank you in advance.

AlexDudko
2008-09-01, 03:44 AM CDT
First, try this command to start the server: /etc/rc.d/init.d/mysqld start
After the server starts you can use it in terminal starting the mysql command line with command mysql

Ghroth
2008-09-01, 03:57 AM CDT
Thank you for really fast replying :D

Strangely I get this now:
[root@localhost /]# /etc/rc.d/init.d/mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]

So.. the service cannot start at all.. I must search about what's wrong with the mysqld.

Edit:
Ok, I changed the user from "mysql" to "root" inside the my.cnf and mysqld is running correctly. And i can see the mysql.conf inside the /var/lib/mysql folder.. but still getting the same error..

Ghroth
2008-09-01, 05:58 AM CDT
Nice, I solved it. I noticed that, the actual path of the mysql.conf that mysql is trying to locate is the '/var/lib/mysql/mysql.sock' but the actual mysql.sock has been generated as '/var/lib/mysql.sock'. So, i tried to make a link like "ln -s /var/lib/mysql.sock /var/lib/mysql/mysql.sock" and it got fixed. (i'm a fast learner ;) )

Hope for no more problems.