Linux下安装MySQL

一、准备

安装包: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.21-70.0-r688-el6-x86_64-bundle.tar

③解压安装包

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

④安装客户端和服务端

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

⑤启动服务

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

⑥修改root密码

[root@localhost mysql]# mysqladmin -u root password "123456"
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 3
Server version: 5.6.21-70.0 Percona Server (GPL), Release 70.0, Revision 688

Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, 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 '123456';
Query OK, 0 rows affected (0.00 sec)

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

⑨防火墙打开3306端口

[root@localhost mysql]# /sbin/iptables -I INPUT -p tcp --dport 3306 -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 防火墙已经开启的端口

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

 

 

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!



点赞
  1. JackLi说道:

    学习了,THX :eek:

发表评论

电子邮件地址不会被公开。 必填项已用*标注