Linux Centos7二进制安装mysql

精帖 168
一讯
一讯 2020-02-28 13:36:09
土匪头子

下载mysqlrepo

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

 

安装mysql-community-release-el7-5.noarch.rpm

sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm

 

安装mysql

sudo yum install mysql-community-server


mysql -u root

    登录时有可能报这样的错:ERROR 2002 (HY000): Cant connect to local MySQL server through socket /var/lib/mysql/mysql.sock (2),原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前用户:

  e)  $ sudo chown -R root:root /var/lib/mysql

    重启mysql服务

    $ service mysqld restart