Compile and install mysql on centos
Environment: centos6.5 mysql-5.6.17.tar.gz
Wgethttp: // cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz
Yum install-y gcc-c ++. x86_64 bison. x86_64 libaio. x86_64 cmake. x86_64 ncurses-devel.x86_64
Follow the official documents below: MySQL 5.6 Manual 2.8.2 Installing MySQL Using a Standard Source Distribution
shell> groupadd mysqlshell> useradd -r -g mysql mysql
Shell>tar zxvf mysql-VERSION.tar.gzShell>cd mysql-VERSIONShell>cmake .Shell>makeShell>make install
Shell>cd /usr/local/mysqlShell>chown -R mysql .Shell>chgrp -R mysql .Shell>scripts/mysql_install_db --user=mysqlShell>chown -R root .Shell>chown -R mysql dataShell>Bin/mysqld_safe -- user = mysql &
After the installation is complete, an error is reported during startup:
/Usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysqld. pid '(Errcode: 2-No such file or directory)
Cd/var/run/
Mkdir mysqld
Chown-R mysql mysqld
Chgrp-R mysql mysqld
Restart:
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'MySQL. user' doesn' t exist
Modify:/usr/local/mysql/my. cnf
Datadir =/usr/local/mysql/data
Restart your computer
Mysql. server start started successfully
./Bin/mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql. sock' (2)
Ln-s/var/lib/mysql. sock/tmp/mysql. sock
After executing this command, mysql is successfully run.