环境描述:

操作系统:Red Hat Enterprise Linux Server release 6.5

Mysql安装包:MySQL-5.6.35-1.linux_glibc2.5.x86_64.rpm-bundle.tar

1.首先检查是否预安装了mysql:

[root@mysql ~]# 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@mysql ~]# mkdir -p /usr/local/mysql

4.创建用户和组:

[root@mysql ~]# groupadd -g 1000 mysql
[root@mysql ~]# useradd mysql -g mysql -p mysql

5.解压缩安装包:

[root@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 

6.安装mysql,只需要安装如下包:

 ##Server包:
[root@mysql ~]# rpm -ivh MySQL-server-5.6.35-1.linux_glibc2.5.x86_64.rpm
 ##Client包:
[root@mysql ~]# rpm -ivh MySQL-client-5.6.35-1.linux_glibc2.5.x86_64.rpm
 ##库函数包:
[root@mysql ~]# rpm -ivh MySQL-devel-5.6.35-1.linux_glibc2.5.x86_64.rpm
[root@mysql ~]# rpm -ivh MySQL-shared-5.6.35-1.linux_glibc2.5.x86_64.rpm

7.查看进程、端口是否启动:

[root@mysql ~]# ps -ef|grep mysqld       ##查看mysqld进程是否启动
[root@mysql ~]# netstat -an |grep :3306  ##查看端口是否正常,LISTEN 为正常状态
 ##如果没有开启,运行:service mysql start

8.登录mysql,修改root密码:

[root@mysql ~]# mysqladmin -u root -p password 

9.登录MySQL数据库:

[root@mysql ~]# 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>

 

posted on 2017-03-22 15:38  Tomatoes  阅读(633)  评论(0编辑  收藏  举报