mysql源码安装

1.环境介绍
OS: Redhat Linuix 6.5
MySQL: mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar

2.系统设置
2.1 selinuix修改
[root@localhost mysql]# vi  /etc/selinux/config 
SELINUX=disabled


3.检查系统中是否带有mysql
[root@localhost soft]# rpm -qa| grep mysql
mysql-libs-5.1.71-1.el6.x86_64
[root@localhost soft]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

4.安装
[root@localhost mysql]# tar -xvf mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar 
mysql-community-libs-5.7.21-1.el6.x86_64.rpm
mysql-community-devel-5.7.21-1.el6.x86_64.rpm
mysql-community-server-5.7.21-1.el6.x86_64.rpm
mysql-community-test-5.7.21-1.el6.x86_64.rpm
mysql-community-embedded-5.7.21-1.el6.x86_64.rpm
mysql-community-client-5.7.21-1.el6.x86_64.rpm
mysql-community-libs-compat-5.7.21-1.el6.x86_64.rpm
mysql-community-common-5.7.21-1.el6.x86_64.rpm
mysql-community-embedded-devel-5.7.21-1.el6.x86_64.rpm

--使用nodeps避免包冲突
rpm -ivh   mysql-community-server-5.7.21-1.el6.x86_64.rpm  --nodeps
rpm -ivh   mysql-community-client-5.7.21-1.el6.x86_64.rpm  --nodeps
rpm -ivh   mysql-community-common-5.7.21-1.el6.x86_64.rpm  --nodeps
rpm -ivh mysql-community-devel-5.7.21-1.el6.x86_64.rpm                   --nodeps
rpm -ivh mysql-community-embedded-5.7.21-1.el6.x86_64.rpm                --nodeps
rpm -ivh mysql-community-embedded-devel-5.7.21-1.el6.x86_64.rpm          --nodeps
rpm -ivh mysql-community-libs-5.7.21-1.el6.x86_64.rpm                    --nodeps
rpm -ivh mysql-community-libs-compat-5.7.21-1.el6.x86_64.rpm             --nodeps
rpm -ivh mysql-community-test-5.7.21-1.el6.x86_64.rpm                    --nodeps

--启动mysql
[root@localhost soft]# mkdir -p /mysql/data
[root@localhost soft]# mkdir -p /mysql/log/
[root@localhost soft]# mkdir -p /mysql/run/mysqld

[root@localhost soft]# vi  /etc/my.cnf
datadir=/mysql/data
socket=/mysql/mysql.sock
log-error=/mysql/log/mysqld.log
pid-file=/mysql/run/mysqld/mysqld.pid

[root@localhost log]# /etc/init.d/mysqld  start
Initializing MySQL database:                               [  OK  ]
Starting mysqld:                                           [  OK  ]

5.mysql安全设置
5.1 查看密码
[root@localhost log]#  cat mysqld.log | grep password
2018-01-21T13:27:36.164705Z 1 [Note] A temporary password is generated for root@localhost: T&DH+Ij*H9kd

5.2.<span white-space:normal;background-color:#f8f8f8;"="">安全设置  
[root@localhost log]#  /usr/bin/mysql_secure_installation 
Enter password for user root: 
The existing password for the user account root has expired. Please set a new password.
New password: 

5.3 登录成功
[root@localhost log]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 24
Server version: 5.7.21 MySQL Community Server (GPL)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.02 sec)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值