史上最简单的MySQL安装教程之Linux(CentOS6.8)下安装MySQL5.6

时间:2024-10-27 23:05:50

一、准备

安装包:Percona-Server-5.6.21-70.0-r688-el6-x86_64-bundle.tar

MySQL下载地址:http://www.percona.com/doc/percona-server/5.6/

二、安装

①首先安装cmake

命令:yum -y install cmake

[root@localhost opt]# yum -y install cmake

②上传安装包

[root@localhost /]# cd /usr/local/src/
[root@localhost src]# mkdir mysql
[root@localhost src]# cd mysql
[root@localhost mysql]# rz
[root@localhost mysql]# ls
Percona-Server-5.6.-70.0-r688-el6-x86_64-bundle.tar

③解压安装包

[root@localhost mysql]# tar -xvf Percona-Server-5.6.-70.0-r688-el6-x86_64-bundle.tar
Percona-Server--debuginfo-5.6.-rel70..el6.x86_64.rpm
Percona-Server-client--5.6.-rel70..el6.x86_64.rpm
Percona-Server-devel--5.6.-rel70..el6.x86_64.rpm
Percona-Server-server--5.6.-rel70..el6.x86_64.rpm
Percona-Server-shared--5.6.-rel70..el6.x86_64.rpm
Percona-Server-test--5.6.-rel70..el6.x86_64.rpm
Percona-Server-tokudb--5.6.-rel70..el6.x86_64.rpm

④安装客户端和服务端

[root@localhost mysql]# rpm -ivh Percona-Server-shared--5.6.-rel70..el6.x86_64.rpm
warning: Percona-Server-shared--5.6.-rel70..el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing... ########################################### [%]
:Percona-Server-shared-########################################### [%]
[root@localhost mysql]# rpm -ivh Percona-Server-client--5.6.-rel70..el6.x86_64.rpm
warning: Percona-Server-client--5.6.-rel70..el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing... ########################################### [%]
:Percona-Server-client-########################################### [%]
[root@localhost mysql]# rpm -ivh Percona-Server-server--5.6.-rel70..el6.x86_64.rpm

⑤启动服务

[root@localhost mysql]# service mysql start
Starting MySQL (Percona Server).. [确定]

⑥修改root密码

[root@localhost mysql]# mysqladmin -u root password ""
Warning: Using a password on the command line interface can be insecure.

⑦登录成功

[root@localhost mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6.-70.0 Percona Server (GPL), Release 70.0, Revision Copyright (c) - Percona LLC and/or its affiliates
Copyright (c) , , 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> grant all privileges on *.* to 'root' @'%' identified by '';
Query OK, rows affected (0.00 sec) mysql> flush privileges;
Query OK, rows affected (0.00 sec)

⑨防火墙打开3306端口

[root@localhost mysql]# /sbin/iptables -I INPUT -p tcp --dport  -j ACCEPT   #开启防火墙
[root@localhost mysql]# /etc/rc.d/init.d/iptables save #当前规则保存,保证开机后也是开启的
iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [确定]
[root@localhost mysql]# /etc/init.d/iptables status #查看iptables 防火墙已经开启的端口

如果安装不成功,过来打我。☺☺☺☺

版权声明:本文为博主原创文章,允许转载,但转载必须标明出处。