centos部署mysql
一、下载mysql及依赖
分别下载这四个:
server、client、libs、common
二、下载好之后上传---安装
按顺序执行
rpm -ivh mysql-community-common-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.16-1.el6.x86_64.rpm
三、查看是否安装成功
mysqladmin --version
四、mysql相关命令
启动
systemctl start mysqld.service
停止
systemctl stop mysqld.service
开机自启动
systemctl enable mysqld.sercice
五、初始化密码查询
sudo grep 'temporary password' /var/log/mysqld.log
六、修改密码
mysql admin -u root -p swQalt9B>B=> password click1
七、问题记录
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
解决方法:
增加链接:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock