CentOS 6.9下MySQL5.7.19安装步骤
2017-11-17 18:39
316 查看
目录
[TOC]
猛戳下载
[TOC]
1、查看当前安装的Linux版本
[bruce@www ~]$ sudo lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.9 (Final) Release: 6.9 Codename: Final
2、下载对应MySQL 安装包
官方网站猛戳下载
3、清理老版本MySQL
3.1、查看操作系统中是否已安装MySQL
[bruce@www ~]$ sudo rpm -qa | grep mysql mysql-5.1.73-8.el6_8.x86_64 mysql-server-5.1.73-8.el6_8.x86_64 mysql-libs-5.1.73-8.el6_8.x86_64
3.2、删除老版本MySQL数据库安装包
[bruce@www ~]$ sudo rpm -e --nodeps mysql-5.1.73-8.el6_8.x86_64 [bruce@www ~]$ sudo rpm -e --nodeps mysql-server-5.1.73-8.el6_8.x86_64 [bruce@www ~]$ sudo rpm -e --nodeps mysql-libs-5.1.73-8.el6_8.x86_64
3.3、查找老版本MySQL安装遗留的目录和文件
[bruce@www ~]$ find / -name mysql /var/lib/mysql
3.4、删除老版本MySQL安装遗留的目录和文件
[bruce@www ~]$ sudo rm -rf /var/lib/mysql
4、安装新版本MySQL
4.1、解包
[bruce@www softs]$ tar -xvf mysql-5.7.19-1.el6.x86_64.rpm-bundle.tar mysql-community-libs-5.7.19-1.el6.x86_64.rpm mysql-community-devel-5.7.19-1.el6.x86_64.rpm mysql-community-embedded-5.7.19-1.el6.x86_64.rpm mysql-community-common-5.7.19-1.el6.x86_64.rpm mysql-community-libs-compat-5.7.19-1.el6.x86_64.rpm mysql-community-server-5.7.19-1.el6.x86_64.rpm mysql-community-test-5.7.19-1.el6.x86_64.rpm mysql-community-embedded-devel-5.7.19-1.el6.x86_64.rpm mysql-community-client-5.7.19-1.el6.x86_64.rpm
4.2、安装MySQL
[bruce@www softs]$ sudo rpm -ivh mysql-community-common-5.7.19-1.el6.x86_64.rpm warning: mysql-community-common-5.7.19-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-common ########################################### [100%] [bruce@www softs]$ sudo rpm -ivh mysql-community-libs-5.7.19-1.el6.x86_64.rpm warning: mysql-community-libs-5.7.19-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-libs ########################################### [100%] [bruce@www softs]$ sudo rpm -ivh mysql-community-client-5.7.19-1.el6.x86_64.rpm warning: mysql-community-client-5.7.19-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-client ########################################### [100%] [bruce@www softs]$ sudo rpm -ivh mysql-community-server-5.7.19-1.el6.x86_64.rpm warning: mysql-community-server-5.7.19-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-server ########################################### [100%]
4.3、启动MySQL数据库
[bruce@www ~]$ sudo service mysqld start Initializing MySQL database: [ OK ] Starting mysqld: [ OK ] [bruce@www ~]$ sudo service mysqld stop [bruce@www ~]$ sudo mysqld_safe --user=mysql --skip-grant-tables --skip-networking & [1] 3598 2017-11-15T01:58:49.095993Z mysqld_safe Logging to '/var/log/mysqld.log'. 2017-11-15T01:58:49.129531Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql [bruce@www ~]$ mysql -u root mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.19 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> update user set authentication_string = password('root123') where user = 'root'; Query OK, 1 row affected, 1 warning (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> quit Bye [bruce@www ~]$ sudo service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ] [bruce@www ~]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.7.19 Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> set password for root@localhost = password(')OKM9ijn'); Query OK, 0 rows affected, 1 warning (0.01 sec) mysql> flush privileges; Query OK, 0 rows affected (0.02 sec) mysql> quit Bye
上文中 )OKM9ijn 为设置的密码串,该版本MySQL对数据库用户的密码有严格要求,不接受简单密码,下文同理。
4、远程登录
4.1、授权
[bruce@www ~]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 22 Server version: 5.7.19 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select host, user from user; +-----------+---------------+ | host | user | +-----------+---------------+ | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+---------------+ 3 rows in set (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY ')OKM9ijn' WITH GRANT OPTION; Query OK, 0 rows affected, 1 warning (0.02 sec) mysql> select host, user from user; +-----------+---------------+ | host | user | +-----------+---------------+ | % | root | | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+---------------+ 4 rows in set (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.07 sec)
4.2、测试
在其他机器上测试C:\>mysql -h 192.168.1.144 -u root -p Enter password: ******** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 23 Server version: 5.7.19 MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
相关文章推荐
- CentOS第一次安装MySQL的完整步骤
- 阿里云centos7mysql 5.6 的安装步骤记录
- centos6.5 rpm安装mysql5.6.19操作及步骤
- CentOS 6.0 系统 LAMP(Apache+MySQL+PHP)安装步骤
- CentOS 7中安装mysql server的步骤分享
- windows-mysql5.7.19免安装版安装步骤和注意
- CentOS 6.0 系统 LAMP(Apache+MySQL+PHP) 安装步骤
- linux(centOS6) 安装Mysql 5.6.19数据库步骤、 问题以及相应的解决办法
- centos6.4 rpm mysql安装步骤
- Linux[Centos7] yum安装mysql步骤
- 腾讯云服务器CentOS安装JDK+Tomcat+MySQL详细步骤(以及遇到的各种坑)
- CentOS5.2安装mysql用163yum源安装具体步骤。
- CentOS 6.0 系统 LAMP(Apache+MySQL+PHP)安装步骤
- CentOS7.3系统安装mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
- CentOS 6.4系统通过yum安装 LAMP(Apache+MySQL+PHP)安装步骤及其卸载步骤
- CentOS Mysql-5.7.19免安装版配置(可安装多个)
- CentOS 6.0 系统 LAMP(Apache+MySQL+PHP) 安装步骤
- CentOS6.3 源码安装 mysql 步骤
- centos 7.5+mysql 5.7 RPM安装步骤
- Linux(CentOS7.3)使用yum安装MySQL详细步骤