Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I get the error below when attempting to manually install mysql-5.6.17-linux-glibc2.5-x86_64

Steps I followed:

1. tar -xzvf mysql-standard-5.1.34-linux-i686-glibc23.tar.gz
2. ln -s mysql-standard-5.1.34-linux-i686-glibc23 mysql
 a) set basedir= to the full path of your new mysql directory
 b) set datadir= to the full path of the /data subdir in your new mysql directory.
3. Set up the default MySQL databases:
 a) ./scripts/mysql_install_db --defaults-file=mysql.cnf
 b) ./bin/mysqladmin --defaults-file=mysql.cnf -u root password "yourpasswordhere"
4. Create a New Database and User Account
 a) Log in to your mysql server as root: ./bin/mysql --defaults-file=mysql.cnf -u root -p

mysql.cnf file looks like:

[client]
socket=/tmp/mysql_2.sock
port=3307
####################################
[mysqld]
#REQUIRED!!
#Change the basedir directory to reflect your mysql home directory
basedir=/mysql
#REQUIRED!!
#Change the data direcory to reflect your mysql data directory
datadir=/mysql/data
port=3307
socket=/tmp/mysql_2.sock
key_buffer_size=64M

#[OPTIMIZATION]
#Set this value to 50% of available RAM if your environment permits.
myisam_sort_buffer_size=1.5G
#[OPTIMIZATION]
#This value should be at least 50% of free hard drive space. Use caution if         setting it to 100% of free space however. Your hard disk may fill up!
myisam_max_sort_file_size=100G

#[OPTIMIZATION]
#Our default of 2G is probably fine for this value. Change this value only if you are using a machine with little resources available. 
read_buffer_size=1.5G  

command:

root@ubuntu:/mysql#  ./bin/mysqld_safe --defaults-    file=mysql.cnf &  

Error:

[1] 2386
root@ubuntu:/mysql# 140415 19:08:12 mysqld_safe Logging to '/mysql/data/ubuntu.err'.
chown: invalid user: `mysql'  
140415 19:08:12 mysqld_safe Starting mysqld daemon with databases from     /mysql/data
140415 19:08:12 mysqld_safe mysqld from pid file     /mysql/data/ubuntu.pid ended  

./bin/mysqladmin --defaults-file=mysql.cnf -u   
./bin/mysqladmin --defaults-file=mysql.cnf -u root password 12345
./bin/mysqladmin: connect to server at 'localhost' failed  

error: 'Can't connect to local MySQL server through socket '/tmp/mysql_2.sock' (2)' 

Check that mysqld is running and that the socket: '/tmp/mysql_2.sock' exists!
[1]+  Done                    ./bin/mysqld_safe --defaults-file=mysql.cnf    

I tried to login by command:

./bin/mysql --defaults-file=mysql.cnf -u root -p  

Error:

Enter password:   

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql_2.sock' (2)
share|improve this question
    
"Check that mysqld is running and that the socket: '/tmp/mysql_2.sock' exists!" –  Rinzwind Apr 15 at 14:29
    
You need to tell us what you've done to install it. For example, you seem not to have created the mysql user who is apparently needed: chown: invalid user: mysql'` –  terdon Apr 15 at 14:31
    
@Rinzwind '/tmp/mysql_2.sock' does not exist. How to check is mysqld working? –  Nari2 Apr 15 at 14:31
    
@terdon I am trying to create a New Database and User Account. login to it and create a new schema. –  Nari2 Apr 15 at 14:35
    
@nari2 that should be a question you should not need to ask. ps -ef | grep mysql would be my choice. By the way: if the socket is not created you probably have permissions problems. –  Rinzwind Apr 15 at 14:41

2 Answers 2

You should:

  1. Add a user for your mysql server useradd -r -s /bin/false -m -d /mysql mysql
  2. Write an upstart script for your server.
  3. Check that the pid file and socket files can be created by your mysql user by executing the proper chmod's.
share|improve this answer
    
useradd: user 'mysql' already exists. –  Nari2 Apr 16 at 6:08

There are a couple of steps to check when you do it manually that could create the error mentioned above. I will assume you either manually downloaded MySQL from the official site or used a 3rd party PPA to install it:

  • Check that mysql is not already running:

    ps -e|grep -i 'mysqld'.

    If it appears then you need to kill it by doing a sudo killall -9 mysqld. In the case it does not die, then grab the PID from the ps you ran and kill -9 PID

  • Run mysql via /etc/init.d/mysql start to see if it creates the same error. If it gives you the exact same error from above then you need to copy the mysql.server file which is found in the support-files folder inside the mysql folder you downloaded or in the /usr/local/mysql folder and you need to copy it to /etc/init.d/mysql eg:

    cp mysql.server /etc/init.d/mysql and give it a executable permission chmod +x then try running /etc/init.d/mysql start again.

  • If it still gives you a problem then you need to edit the config file in /etc/my.cnf and change ALL the /tmp/mysql.socket lines to /var/run/mysqld/mysqld.sock or any other socket place you wish to send it. Note that the config file can also be in /etc/mysql/my.cnf in some cases like mine. The config file has at least 3 lines you need to change.

share|improve this answer
    
mysqld not running. /etc/init.d does not contain mysql file or folder. –  Nari2 Apr 16 at 5:50
    
There you go. Now copy the mysql server script found on the downloaded tar to the init folder and give it executable permissions. Then run it. –  Luis Apr 16 at 14:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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