新聞中心
個人比較喜歡 mysql 的輕量,今天花了一點時間把云服務上的 MySQL5.7 換成了 Percona-server ,Percona 是一個開源的 MySQL 衍生版。InnoDB的數(shù)據(jù)庫引擎使得 Percona 服務器非常有吸引力,如果你需要的高性能,高可靠性和高性價比的解決方案,它將是一個很好的選擇。
安裝
#安裝 yum 源
yum install http://www.percona.com/downloads/percona-release/RedHat/0.1-3/percona-release-0.1-3.noarch.rpm
#測試 YUM 源是否生效
yum list | grep percona
#安裝 Percona-Server
yum install Percona-Server-server-57 Percona-Server-client-57
#啟動服務
service mysqld start
#登錄 MySQL
mysql -u root -p

創(chuàng)新互聯(lián)建站是專業(yè)的余干網(wǎng)站建設公司,余干接單;提供網(wǎng)站建設、網(wǎng)站制作,網(wǎng)頁設計,網(wǎng)站設計,建網(wǎng)站,PHP網(wǎng)站建設等專業(yè)做網(wǎng)站服務;采用PHP框架,可快速的進行余干網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!
mysql5.7.x 安裝完成后會初始化一個 root 用戶的隨機密碼,在 /var/log/mysqld.log 日志中可以查看到,也可以通過命令查找
[root@iZ11fek1j6cZ lib]# grep 'temporary password' /var/log/mysqld.log
2016-11-19T09:43:01.644617Z 1 [Note] A temporary password is generated for root@localhost: LibldhWL+9Fd
#修改密碼
ALTER USER USER() IDENTIFIED BY 'xxxxxxx';
#重啟 MySQL 服務
service mysql restart
#安裝配置
[root@iZ11fek1j6cZ lib]# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
#修改編碼
vi /etc/my.cnf
[client]
default-character-set = utf8
[mysqld]
default-storage-engine = INNODB
character-set-server = utf8
collation-server = utf8_general_ci
#檢查編碼
[root@iZ11fek1j6cZ etc]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
[root@iZ11fek1j6cZ etc]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.15-9 Percona Server (GPL), Release 9, Revision 9f0fd0a
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
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> show variables like '%char%';
+--------------------------------------+-------------------------------------+
| Variable_name | Value |
+--------------------------------------+-------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/percona-server/charsets/ |
| validate_password_special_char_count | 1 |
+--------------------------------------+-------------------------------------+
9 rows in set (0.00 sec)
#開啟啟動服務
systemctl enable mysqld.service
#關閉防火墻
systemctl stop firewalld.service #停止
systemctl disable firewalld.service #禁用
#開啟遠程連接
use mysql;
mysql>
update user set host = '%' where user = 'root';
mysql>select host, user from user;
#配置文件
Percona Server stores the data files in /var/lib/mysql/ by default. You can find the configuration file that is used to manage Percona Server in /etc/my.cnf.
REFER:
https://www.percona.com/doc/percona-server/5.7/installation/yum_repo.html
Percona Server 使用了一些 google-mysql-tools, Proven Scaling, Open Query 對 MySQL 進行改造。
當前文章:CentOS7.2安裝配置PerconaServer
URL鏈接:http://fisionsoft.com.cn/article/djjcepg.html


咨詢
建站咨詢
