搜狐mysql下载地址
http://mirrors.sohu.com/mysql/MySQL-5.7/
系统环境:
[root@db02 ~]# uname -r 2.6.32-696.el6.x86_64 [root@db02 ~]# uname -m x86_64 [root@db02 ~]# cat /etc/redhat-release CentOS release 6.9 (Final)
安装
一、建立目录
mkdir -p /server/tools mkdir -p /application# 将mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz上传到/server/tools
# 将mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz.md5也上传到/server/toolsmysql二、验证安装包是否无缺,并解压
[root@db02 tools]# md5sum -c mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz.md5 mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz: OK [root@db02 ~]# cd /server/tools/ [root@db02 tools]# tar -zxf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz [root@db02 tools]# mv /server/tools/mysql-5.7.17-linux-glibc2.5-x86_64 /application/mysql-5.7.17三、建立用户mysql管理Mysql5.7数据库
useradd mysql -M -s /sbin/nologin id mysql四、受权
chown -R mysql.mysql /application/mysql-5.7.17/五、初始化,记录此步骤生成的临时密码(*******必定要记住******)
[root@db02 tools]# /application/mysql-5.7.17/bin/mysqld --initialize --user=mysql --basedir=/application/mysql-5.7.17/ --datadir=/application/mysql-5.7.17/data 2018-04-02T05:37:58.545594Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-04-02T05:38:00.301715Z 0 [Warning] InnoDB: New log files created, LSN=45790 2018-04-02T05:38:00.490353Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2018-04-02T05:38:00.597912Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 017f2649-3638-11e8-ab8f-000c29cb5b53. 2018-04-02T05:38:00.601057Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2018-04-02T05:38:00.627614Z 1 [Note] A temporary password is generated for root@localhost: u_Z/qkry.0h3 ######## 注意:A temporary password is generated for root@localhost: u_Z/qkry.0h3 ######## 生成了临时密码,要记住************** [root@db02 tools]# echo $? 0六、拷贝配置文件和启动文件
cp /application/mysql-5.7.17/support-files/my-default.cnf /etc/my.cnf cp /application/mysql-5.7.17/support-files/mysql.server /etc/init.d/mysqld-5.7.17 sed -i 's#/usr/local/mysql#/application/mysql-5.7.17#g' /application/mysql-5.7.17/bin/mysqld_safe /etc/init.d/mysqld-5.7.17七、启动mysql服务,查看版本
/etc/init.d/mysqld-5.7.17 start /application/mysql-5.7.17/bin/mysql --version八、修改mysql用户root的密码,此时要输入临时密码 u_Z/qkry.0h3
[root@db02 tools]# /application/mysql-5.7.17/bin/mysqladmin -uroot -p password '123' Enter password: mysqladmin: [Warning] Using a password on the command line interface can be insecure. Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety九、清除命令行记录(可不执行)
history -c
注:读者可根据自身状况进行灵活的配置安装,谢谢您的阅读!linux