-1

I am new to mysql dba, and I am trying to install mysql in linux envirnoment on my personal laptop. I have a problem in starting the mysql server. I install it with the following commands:

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /home/linux/Desktop/mysql-VERSION-OS.tar.gz    
shell> ln -s mysql-5.5.51-linux2.6-x86_64 mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql

After this command I get this error:

erro160928 4:36:11 [ERROR] /usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2) 160928 4:36:11 [ERROR] Can't start server: can't create PID file: No such file or directory

Do we need to create pid and socket manually?

2

The issue seem to be with PID file which is made by default /var/run/mysqld/mysqld.pid as you might not have /var/run/mysqld directory or user mysql does not have permissions on this.

Either create PID file in some other directory by using following parameter in your config file, by default it would use /etc/my.cnf

pid-file=\< directory-path-of-your-choice \>

or just create /var/run/mysqld and change it's permissions to mysql:mysql

mkdir /var/run/mysqld  
chown -R mysql:mysql /var/run/mysqld

With regards to socket issue you can also pass the value for socket as well in my.cnf, use following parameter in config file

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

you would require an instance restart for this

now start service and let know if you face any error.

Moreover you can connect to your instrance without socket

mysql -uuser -ppass -Pport --protocol=TCP

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.