centos下安装mysql

下载:Percona-Server-5.6.15-rel63.0-519.Linux.x86_64.tar.gz
useradd -s /sbin/nologin mysql
mkdir /data/mysql/data -p
mkdir /data/mysql/log -p
alias cp=cp
yum install gcc* -y
cp -f /root/my.cnf /etc
tar -xzf /root/Percona-Server-5.6.15-rel63.0-519.Linux.x86_64.tar.gz -C /usr/local
ln -s /usr/local/Percona-Server-5.6.15-rel63.0-519.Linux.x86_64 /usr/local/mysql
ln -s /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.6
ln -s /usr/lib64/libcrypto.so.10 /usr/lib64/libcrypto.so.6
cd /usr/local/mysql
./scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/
/etc/init.d/mysql start
echo "/usr/local/mysql/lib" >> /etc/ld.so.conf.d/mysql-x86_64.conf
ldconfig


将my.cnf文件拷贝到 /usr/local/mysql/下
修改my.cnf文件中mysql.sock的路径,找到mysql.sock文件位置进行更改(根目录下:find / mysql.sock)
重启数据库:/etc/init.d/mysql restart


进入mysql
mysql  -S /var/lib/mysql/mysql.sock

授权
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 

猜你喜欢

转载自episode.iteye.com/blog/2325699

相关文章