操作系統:Red Hat Enterprise Linux Server release 6.5
Mysql安裝包:MySQL-5.6.35-1.linux_glibc2.5.x86_64.rpm-bundle.tar
##rpm安裝包都是以bundle.tar結尾的,上傳的時候請注意。
1.檢查是否預安裝了MYSQL
[root@lgr ~]# rpm -qa | grep -i mysql
perl-DBD-MySQL-4.013-3.el6.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
mysql-devel-5.1.71-1.el6.x86_64
MySQL-python-1.2.3-0.3.c1.1.el6.x86_64
mysql-5.1.71-1.el6.x86_64
mysql-server-5.1.71-1.el6.x86_64
mysql-libs-5.1.71-1.el6.x86_64
2.移除預安裝的MYSQL
rpm -e mysql-server-5.1.71-1.el6.x86_64 --nodeps
rpm -e mysql-devel-5.1.71-1.el6.x86_64 --nodeps
rpm -e mysql-5.1.71-1.el6.x86_64 --nodeps
rpm -e mysql-connector-odbc-5.1.5r1144-7.el6.x86_64 --nodeps
rpm -e MySQL-python-1.2.3-0.3.c1.1.el6.x86_64 --nodeps
rpm -e perl-DBD-MySQL-4.013-3.el6.x86_64 --nodeps
rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps
rm -rf /var/lib/mysql*
rm -rf /usr/share/mysql*
userdel mysql
3.創建安裝包上傳目錄
[root@lgr ~]# mkdir -p /usr/local/mysql
4.上傳安裝包到mysql目錄
--上傳過程略--
5.創建用戶和組
[root@lgr ~]# groupadd -g 1000 mysql
[root@lgr ~]# useradd mysql -g mysql -p mysql
6.解壓縮安裝包
[root@lgr mysql]# tar -xvf MySQL-5.6.35-1.linux_glibc2.5.x86_64.rpm-bundle.tar
MySQL-devel-5.6.35-1.linux_glibc2.5.x86_64.rpm
MySQL-test-5.6.35-1.linux_glibc2.5.x86_64.rpm
MySQL-shared-5.6.35-1.linux_glibc2.5.x86_64.rpm
MySQL-shared-compat-5.6.35-1.linux_glibc2.5.x86_64.rpm
MySQL-server-5.6.35-1.linux_glibc2.5.x86_64.rpm
MySQL-embedded-5.6.35-1.linux_glibc2.5.x86_64.rpm
MySQL-client-5.6.35-1.linux_glibc2.5.x86_64.rpm
7.安裝mysql,只需要安裝如下包
##Server包:
[root@lgr mysql]# rpm -ivh MySQL-server-5.6.35-1.linux_glibc2.5.x86_64.rpm
##Client包:
[root@lgr mysql]# rpm -ivh MySQL-client-5.6.35-1.linux_glibc2.5.x86_64.rpm
##庫函數包:
[root@lgr mysql]# rpm -ivh MySQL-devel-5.6.35-1.linux_glibc2.5.x86_64.rpm
[root@lgr mysql]# rpm -ivh MySQL-shared-5.6.35-1.linux_glibc2.5.x86_64.rpm
8.查看進程、端口是否啟動
[root@lgr ~]# ps -ef|grep mysqld ##查看mysqld進程是否啟動
[root@lgr ~]# netstat -an |grep :3306 ##查看端口是否正常,LISTEN 為正常狀態
##如果沒有開啟,運行:service mysql start
9.登錄mysql,修改root密碼
[root@lgr ~]# mysqladmin -u root -p password
## root ---用戶名
10.登錄MySQL數據庫
[root@lgr ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.6.35 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.
mysql>
The End!
2017-08-17