mysql 5.7安装方法(centos)2019-04-18 10:27:49

( 1人已投票,[高质量] )
分享:
31.3K

//下载源文件,也可以直接本地下载然后通过工具拖放到/root内

wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar


//解压文件 注意名称要一致

tar -xvf mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar


//安装

依次执行(几个包有依赖关系,所以执行有先后)下面命令安装

[root@centos-linux ~]# rpm -ivh mysql-community-common-5.7.16-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-libs-5.7.16-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-client-5.7.16-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm

在安装rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm的时候报错如下:

[root@linux_node_1 src]# rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm
 warning: mysql-community-server-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
 error: Failed dependencies:
 libaio.so.1()(64bit) is needed by mysql-community-server-5.7.16-1.el7.x86_64
 libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.16-1.el7.x86_64
 libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.16-1.el7.x86_64
 net-tools is needed by mysql-community-server-5.7.16-1.el7.x86_64


这个报错的意思是需要安装libaio包和net-tools包:可以yum安装一下,安装 libaio-0.3.107-10.el6.x86_64.rpm,下载地址:

wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm

然后yum安装net-tools  

yum install net-tools  完成之后就可以顺利安装


//服务启动

# service httpd start      //apache start.........

# service mysqld stop    //stop

# service mysqld status    //statu check


初始随机密码:

# cat /var/log/mysqld.log | more

修改初始密码及授权远程访问:


# mysql -uroot -p
mysql> set password='Pwd@123456';
mysql> grant all privileges on *.* to 'root'@'%' identified by 'Pwd@123456';

密码复杂度属性:

mysql> set global validate_password_policy=0;//默认为1,必须得有数字字母和特殊字符


为了保证数据库目录为与文件的所有者为 mysql 登陆用户,如果你是以 root 身份运行 mysql 服务,需要执行下面的命令初始化

mysqld --initialize --user=mysql







头像

snowcoal
  • mysql
  • mysql_5.7
  • 软件安装

收藏到我的私密空间

标题:mysql 5.7安装方法(centos)

作者:花花世界

你暂未登录,请登录后才可收藏至您的私密空间 确认取消
雪炭网

键盘操作 更便捷 -雪炭网雪中送炭-乐趣无限