+++++++++++++++++++++++++++++++++++++++++++
标题:MySQL数据库实例部署
时间:2019年3月9日
内容:二进制(rpm)部署MySQL单实例
+++++++++++++++++++++++++++++++++++++++++++
安装流程指导:http://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html
软件下载地址:http://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_64/
https://dev.mysql.com/downloads/mysql/5.7.html#downloads
1. 不同软件包的作用
mysql-community-client-5.7.25-1.el6.x86_64.rpm MySQL服务端程序
mysql-community-server-5.7.25-1.el6.x86_64.rpm MySQL客户端程序
mysql-community-devel-5.7.25-1.el6.x86_64.rpm 通常情况源码包编译时会用到
mysql-community-common-5.7.25-1.el6.x86_64.rpm 客户端和服务器的常见错误消息和字符集
mysql-community-libs-5.7.25-1.el6.x86_64.rpm 共享客户端库
2. 卸载旧版本MySQL
[root@mysql1 ~]# rpm -qa |grep 'mysql'
mysql-libs-5.1.73-3.el6_5.x86_64
[root@mysql1 ~]# yum -y remove mysql-libs-5.1.73-3.el6_5.x86_6
3. 安装MySQL软件
[root@mysql1 ~]# md5sum /soft/mysql-5.7.25-1.el6.x86_64.rpm-bundle.tar
1d614898e91b80581ca599c21c930221 /soft/mysql-5.7.25-1.el6.x86_64.rpm-bundle.tar
[root@mysql1 ~]# tar xvf /soft/mysql-5.7.25-1.el6.x86_64.rpm-bundle.tar
mysql-community-common-5.7.25-1.el6.x86_64.rpm
mysql-community-libs-5.7.25-1.el6.x86_64.rpm
mysql-community-client-5.7.25-1.el6.x86_64.rpm
mysql-community-server-5.7.25-1.el6.x86_64.rpm
mysql-community-devel-5.7.25-1.el6.x86_64.rpm
[root@mysql1 ~]# yum -y localinstall mysql-community-common-5.7.25-1.el6.x86_64.rpm
[root@mysql1 ~]# yum -y localinstall mysql-community-libs-5.7.25-1.el6.x86_64.rpm
[root@mysql1 ~]# yum -y localinstall mysql-community-client-5.7.25-1.el6.x86_64.rpm
[root@mysql1 ~]# yum -y localinstall mysql-community-server-5.7.25-1.el6.x86_64.rpm
[root@mysql1 ~]# yum -y localinstall mysql-community-devel-5.7.25-1.el6.x86_64.rpm
4. 初始化并启动MySQL
[root@mysql1 ~]# cp /soft/my3306.cnf /etc/my.cnf
[root@mysql1 ~]# mkdir -p /data/mysql/{mysql,logs}
[root@mysql1 ~]# chown mysql.mysql /data/ -R
[root@mysql1 ~]# mysqld --initialize-insecure --user=mysql //不配置初始密码
[root@mysql1 ~]# service mysqld start
或
[root@mysql1 ~]# mysqld_safe --user=mysql &
[root@mysql1 ~]# chkconfig --level 345 mysqld on
[root@mysql1 ~]# chkconfig --list |grep 'mysql'
mysqld 0:off 1:off 2:off 3:on 4:on 5:on 6:off
5. 权限初始化
[root@mysql1 ~]# mysql
mysql> select user , host , authentication_string from mysql.user;
mysql> grant all on *.* to root@'localhost' identified by 'break';
mysql> flush privileges;
mysql> select user , host , authentication_string from mysql.user;
[root@mysql1 ~]# mysql -p
Enter password:
软件仓库安装MySQL注意事项:
第一:yum软件仓库默认安装GA的最新版本
第二:确定需要安装MySQL版本配置yum-config-manager,命令如下:
yum-config-manager --disable/--enable mysql57-community
转载于:https://www.cnblogs.com/lv1572407/p/10427506.html