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 -pmysql.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) 11 3 Answers
You should:
- Add a user for your mysql server
useradd -r -s /bin/false -m -d /mysql mysql - Write an upstart script for your server.
- Check that the
pidfile and socket files can be created by yourmysqluser by executing the properchmod's.
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 thepsyou ran andkill -9 PIDRun mysql via
/etc/init.d/mysql startto see if it creates the same error. If it gives you the exact same error from above then you need to copy themysql.serverfile which is found in the support-files folder inside the mysql folder you downloaded or in the/usr/local/mysqlfolder and you need to copy it to/etc/init.d/mysqleg:cp mysql.server /etc/init.d/mysqland give it a executable permission chmod +x then try running/etc/init.d/mysql startagain.If it still gives you a problem then you need to edit the config file in
/etc/my.cnfand change ALL the/tmp/mysql.socketlines to/var/run/mysqld/mysqld.sockor any other socket place you wish to send it. Note that the config file can also be in/etc/mysql/my.cnfin some cases like mine. The config file has at least 3 lines you need to change.
If your file my.cnf (usually in the /etc/mysql/folder) is correctly configured with
socket=/var/lib/mysql/mysql.sockyou can check if mysql is running with the following command:
mysqladmin -u root -p statuschange your permission to mysql folder. If you are working locally, you can do:
sudo chmod -R 755 /var/lib/mysql/