華為雲伺服器centos7.2下Percona-Server-5.6的安裝

weixin_34138377發表於2017-07-08

1.建立mysql目錄,上傳Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar

[root@ecs-fc56-0001 ~]# cd /usr/local/src
[root@ecs-fc56-0001 src]# mkdir mysql
[root@ecs-fc56-0001 src]# ls
hadoop  java  maven  mysql  scala  spark
[root@ecs-fc56-0001 src]# cd mysql
[root@ecs-fc56-0001 mysql]# 

2.解壓,安裝

[root@ecs-fc56-0001 mysql]# tar -xvf Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar
[root@ecs-fc56-0001 mysql]# ls
Percona-Server-5.6.24-72.2-r8d0f85b-el6-x86_64-bundle.tar  Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm
Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm  Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm
Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm     Percona-Server-test-56-5.6.24-rel72.2.el6.x86_64.rpm
Percona-Server-devel-56-5.6.24-rel72.2.el6.x86_64.rpm      Percona-Server-tokudb-56-5.6.24-rel72.2.el6.x86_64.rpm
[root@ecs-fc56-0001 mysql]# 
[root@ecs-fc56-0001 mysql]# rpm -ivh Percona-Server-56-debuginfo-5.6.24-rel72.2.el6.x86_64.rpm
[root@ecs-fc56-0001 mysql]# rpm -ivh Percona-Server-shared-56-5.6.24-rel72.2.el6.x86_64.rpm
[root@ecs-fc56-0001 mysql]# rpm -ivh Percona-Server-client-56-5.6.24-rel72.2.el6.x86_64.rpm
少perl和libaio軟體包
[root@ecs-fc56-0001 mysql]# yum -y  install perl
[root@ecs-fc56-0001 mysql]# yum -y install libaio
[root@ecs-fc56-0001 mysql]# yum -y install autoconf
#此處只能自己手敲,複製有問題,不知道怎麼回事
[root@ecs-fc56-0001 mysql]# rpm –ivh Percona-Server-server-56-5.6.24-rel72.2.el6.x86_64.rpm

3.更改配置檔案

[root@ecs-fc56-0001 mysql]# vim /etc/my.cnf
log-error=/var/lib/mysql/error.log
pid-file=/var/lib/mysql/p.pid
如果不更改,可能出現
The server quit without updating PID file錯誤
可能是/usr/local/mysql/data/mysql.pid檔案沒有寫的許可權
解決方法 :給予許可權,執行 “chown -R mysql:mysql /var/data” “chmod -R 755 /usr/local/mysql/data”  然後重新啟動mysqld!

4.啟動服務

[root@ecs-fc56-0001 ~]# cd /var/lib/mysql/
[root@ecs-fc56-0001 mysql]# ll
總用量 110744
-rw-rw---- 1 mysql mysql       56 7月   8 11:42 auto.cnf
-rw-rw---- 1 mysql mysql        5 7月   8 11:42 ecs-fc56-0001.pid
-rw-r----- 1 mysql root      2578 7月   8 11:44 error.log
-rw-rw---- 1 mysql mysql 12582912 7月   8 11:42 ibdata1
-rw-rw---- 1 mysql mysql 50331648 7月   8 11:42 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 7月   8 11:35 ib_logfile1
drwx------ 2 mysql mysql     4096 7月   8 11:35 mysql
srwxrwxrwx 1 mysql mysql        0 7月   8 11:42 mysql.sock
drwx------ 2 mysql mysql     4096 7月   8 11:35 performance_schema
-rw-r--r-- 1 root  root       131 7月   8 11:35 RPM_UPGRADE_HISTORY
-rw-r--r-- 1 mysql mysql      131 7月   8 11:35 RPM_UPGRADE_MARKER-LAST
drwx------ 2 mysql mysql     4096 7月   8 11:35 test

[root@ecs-fc56-0001 mysql]# service mysql start
Starting MySQL (Percona Server). SUCCESS! 
[root@ecs-fc56-0001 mysql]# service mysql status
 SUCCESS! MySQL (Percona Server) running (7043)
[root@ecs-fc56-0001 mysql]# 
[root@ecs-fc56-0001 mysql]# service mysql stop
Shutting down MySQL (Percona Server).... SUCCESS! 

5.修改密碼,登陸,開啟遠端訪問

預設沒有密碼不安全:
#複製 -u 有問題,自己手敲
[root@ecs-fc56-0001 mysql]# mysqladmin –u root password "root"
[root@ecs-fc56-0001 mysql]# mysql –uroot –proot

語法:
grant [許可權] on [資料庫名].[表名] to ['使用者名稱']@['web伺服器的ip地址'] identified by ['密碼'];

mysql> grant all on *.* to 'root'@'%' identified by 'root';

6.Navicat for MySQL連線


![連線成功的截圖]
(http://upload-images.jianshu.io/upload_images/3661156-a8707c338c0ee1c7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

相關文章