linux(CentOS6.5)下安装Mysql5.6教程


第一步 :检查系统是否自带有mysql版本

命令:rpm -qa | grep mysql

[root@itcast02 local]# rpm -qa | grep mysql
mysql-libs-5.1.73-7.el6.x86_64

第二步 :将其自带的mysql版本全部卸载(非常重要,如不卸载,后面会产生冲突)

命令:rpm -e --nodeps (mysql版本号,就是上面检查到的mysql-libs-5.1.73-7.el6.x86_64)
[root@itcast02 local]# rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64

第三步 :检查是否将自带的mysql版本卸载了 

[root@itcast02 local]# rpm -qa | grep mysql
[root@itcast02 local]#

第四步 :创建mysql的存放目录(我保存在/usr/local/mysql目录下,可以根据自己的喜好创建mysql的保存路径)

[root@itcast01 ~]# mkdir /usr/local/mysql

第五步 :安装传输工具(将mysql压缩包传到/usr/local/mysql目录下)

命令:yum -y install lrzsz
[root@itcast01 ~]# yum -y install lrzsz
已加载插件:fastestmirror
设置安装进程

第六步 :进入到mysql目录下,用鼠标将mysql安装包拖入到mysql目录下

[root@itcast01 ~]# cd /usr/local/mysql
[root@itcast01 mysql]# ls
MySQL-5.6.37-1.el6.x86_64.rpm-bundle.tar

第七步 :将mysql安装包解压到当前目录下

命令:tar -xvf 安装包名称 -C /usr/local/mysql  表示将安装包解压到usr目录下的local目录下的mysql目录下,后面没指定目录则表示解压到当前目录下 (-C /usr/local/mysql 表示指定解压路径 )
[root@itcast01 mysql]# tar -xvf MySQL-5.6.37-1.el6.x86_64.rpm-bundle.tar 
MySQL-shared-5.6.37-1.el6.x86_64.rpm
MySQL-shared-compat-5.6.37-1.el6.x86_64.rpm
MySQL-server-5.6.37-1.el6.x86_64.rpm
MySQL-test-5.6.37-1.el6.x86_64.rpm
MySQL-client-5.6.37-1.el6.x86_64.rpm
MySQL-devel-5.6.37-1.el6.x86_64.rpm
MySQL-embedded-5.6.37-1.el6.x86_64.rpm
[root@itcast01 mysql]#

第八步 :安装所需要的依赖,分别执行以下命令(有些电脑已经安装 ,最好还是执行一下这一步,不然到后面安装报错就比较麻烦了)输入以下命令,点击回车即可,等待安装完成就行

[root@itcast01 mysql]# yum install -y numactl
[root@itcast01 mysql]# yum install -y perl

第九步 :列出解压文件

[root@itcast01 mysql]#ls
MySQL-5.6.37-1.el6.x86_64.rpm-bundle.tar
MySQL-client-5.6.37-1.el6.x86_64.rpm
MySQL-devel-5.6.37-1.el6.x86_64.rpm
MySQL-embedded-5.6.37-1.el6.x86_64.rpm
MySQL-server-5.6.37-1.el6.x86_64.rpm
MySQL-shared-5.6.37-1.el6.x86_64.rpm
MySQL-shared-compat-5.6.37-1.el6.x86_64.rpm
MySQL-test-5.6.37-1.el6.x86_64.rpm

第十步 :安装mysql服务端

[root@itcast01 mysql]# rpm -ivh MySQL-server-5.6.37-1.el6.x86_64.rpm

第十一步 :安装mysql客户端

[root@itcast01 mysql]# rpm -ivh MySQL-client-5.6.37-1.el6.x86_64.rpm

第十二步 :启动mysql服务器

[root@itcast01 mysql]# service mysql star

第十三步 :找mysql登陆密码(最后冒号后面的就是密码)

[root@itcast01 mysql]# cat /root/.mysql_secret

第十四步 :登陆mysql(输入上一步找到的密码)

[root@itcast01 mysql]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.37

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登陆密码

mysql> set password = password('123456');
Query OK, 0 rows affected (0.00 sec)

第十六步 :开启 mysql 的远程登录

mysql> grant all privileges on *.* to 'root' @'%' identified by 'root';
Query OK, 0 rows affected (0.00 sec)

第十七步 :刷新权限

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

第十八步 :退出

mysql> exit
Bye

第十九步 :开放 Linux 的对外访问的端口 3306

[root@itcast01 mysql]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

第二十一步 :将修改永久保存到防火墙中

[root@itcast01 mysql]# /etc/rc.d/init.d/iptables save

第二十二步 :加入到系统服务

[root@itcast01 mysql]# chkconfig --add mysql

第二十三步 :设置开机启动

[root@itcast01 mysql]# chkconfig mysql on



注:我的简书地址:http://www.jianshu.com/u/c9c6c7f38abb
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值