centos 6使用rpm安装mysql 5.6

1:查看os版本
cat /etc/issue 
[root@localhost local]# cat /etc/issue 
Oracle Linux Server release 6.7
Kernel \r on an \m


2:查看内核
[root@localhost local]# uname -a
Linux localhost.localdomain 3.8.13-68.3.4.el6uek.x86_64 #2 SMP Tue Jul 14 15:03:36 PDT 2015 x86_64 x86_64 x86_64 GNU/Linux


3:创建目录。上传包
[root@localhost software]# ls
MySQL-5.6.35-1.el6.x86_64.rpm-bundle.tar
[root@localhost software]# pwd
/home/software


4:解压包
[root@localhost software]# tar -xvf MySQL-5.6.35-1.el6.x86_64.rpm-bundle.tar 
MySQL-test-5.6.35-1.el6.x86_64.rpm
MySQL-embedded-5.6.35-1.el6.x86_64.rpm
MySQL-devel-5.6.35-1.el6.x86_64.rpm
MySQL-shared-5.6.35-1.el6.x86_64.rpm
MySQL-client-5.6.35-1.el6.x86_64.rpm
MySQL-shared-compat-5.6.35-1.el6.x86_64.rpm
MySQL-server-5.6.35-1.el6.x86_64.rpm


5:删除系统自带的mysql包
[root@localhost software]#  rpm -qa | grep mysql 
mysql-libs-5.1.73-5.el6_6.x86_64
[root@localhost software]# yum -y remove mysql-libs-5.1* 
Complete!
[root@localhost software]# rpm -qa | grep mysql
[root@localhost software]# 


6:安装mysql
[root@localhost software]# rpm -ivh MySQL-server-5.6.35-1.el6.x86_64.rpm 
warning: MySQL-server-5.6.35-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]


[root@localhost software]# rpm -ivh MySQL-client-5.6.35-1.el6.x86_64.rpm 
warning: MySQL-client-5.6.35-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]


[root@localhost software]# rpm -ivh MySQL-devel-5.6.35-1.el6.x86_64.rpm 
warning: MySQL-devel-5.6.35-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-devel            ########################################### [100%]


6:修改参数文件
[root@localhost software]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf


7:初始化mysql
[root@localhost software]# /usr/bin/mysql_install_db 


8:强制使用root启动mysql(如果不使用强制启动会报错)
[root@localhost bin]# /usr/sbin/mysqld --user=root &
[root@localhost ~]# ps -ef | grep mysql 
root      9750  9384  0 14:04 pts/1    00:00:00 /usr/sbin/mysqld --user=root
root      9797  9772  0 14:06 pts/2    00:00:00 grep mysql
[root@localhost ~]# netstat -anpt | grep 3306
tcp        0      0 :::3306                     :::*                        LISTEN      9750/mysqld  


9:查看root的初始密码和重新设置密码
[root@localhost ~]# more /root/.mysql_secret 
# The random password set for the root user at Tue Sep  5 13:53:46 2017 (local time): 8oa2yTSLQ9QZpUtg




[root@localhost ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.35


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> SET PASSWORD = PASSWORD('123456');
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@localhost ~]# 


10:验证密码
[root@localhost ~]# mysql -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
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> 
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值