安裝配置參數
[root@monser Percona-Server-5.5.34-rel32.0]# cmake . -DCMAKE_INSTALL_PREFIX=/service/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/service/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_EXAMPLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=30306 -DCOMPILATION_COMMENT=ZWC -DWITH_SSL=system -DWITH_DEBUG=0
[root@monser Percona-Server-5.5.34-rel32.0]# make && make install
建立設定檔
cat > /service/mysql/my.cnf << EOF[client]port = 30306socket = /data/mysql/mysql.sock[mysqld]port = 30306socket = /data/mysql/mysql.sockbasedir = /service/mysqldatadir = /data/mysqlpid-file = /data/mysql/mysql.piduser = mysqlserver-id = 1skip-name-resolveback_log = 600max_connections = 5000max_connect_errors = 6000open_files_limit = 65535table_open_cache = 128 max_allowed_packet = 4Mbinlog_cache_size = 1Mmax_heap_table_size = 8Mtmp_table_size = 16Mread_buffer_size = 2Mread_rnd_buffer_size = 8Msort_buffer_size = 8Mjoin_buffer_size = 8Mkey_buffer_size = 4Mthread_cache_size = 8query_cache_size = 8Mquery_cache_limit = 2Mft_min_word_len = 4log_bin = mysql-binbinlog_format = mixedexpire_logs_days = 7log_error = /data/mysql/mysql-error.logslow_query_log = 1long_query_time = 2slow_query_log_file = /data/mysql/slowsql.logperformance_schema = 0lower_case_table_names = 1skip-external-lockingdefault_storage_engine = InnoDBinnodb_file_per_table = 1innodb_open_files = 500innodb_buffer_pool_size = 64Minnodb_write_io_threads = 4innodb_read_io_threads = 4innodb_thread_concurrency = 0innodb_purge_threads = 1innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodb_log_file_size = 32Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120bulk_insert_buffer_size = 8Mmyisam_sort_buffer_size = 8Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1federated event_scheduler = 1 interactive_timeout = 28800wait_timeout = 28800[mysqldump]quickmax_allowed_packet = 16M[mysql]no-auto-rehash [myisamchk]key_buffer_size = 8Msort_buffer_size = 8Mread_buffer = 4Mwrite_buffer = 4MEOF
初始化系統資料表,啟動Percona Server
[root@monser Percona-Server-5.5.34-rel32.0]# /service/mysql/scripts/mysql_install_db --defaults-file=/service/mysql/my.cnf --basedir=/service/mysql --datadir=/data/mysql --user=mysql Installing MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/service/mysql/bin/mysqladmin -u root password 'new-password'/service/mysql/bin/mysqladmin -u root -h 192.168.1.2 password 'new-password'Alternatively you can run:/service/mysql/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd /service/mysql ; /service/mysql/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd /service/mysql/mysql-test ; perl mysql-test-run.plPlease report any problems with the /service/mysql/scripts/mysqlbug script!Percona recommends that all production deployments be protected with a supportcontract (http://www.percona.com/mysql-suppport/) to ensure the highest uptime,be eligible for hot fixes, and boost your team's productivity.[root@monser Percona-Server-5.5.34-rel32.0]# /service/mysql/bin/mysqld_safe --defaults-file=/service/mysql/my.cnf --basedir=/service/mysql --datadir=/data/mysql --user=mysql & [1] 13051[root@monser Percona-Server-5.5.34-rel32.0]# 140209 00:09:50 mysqld_safe Logging to '/data/mysql/mysql-error.log'.140209 00:09:50 mysqld_safe Starting mysqld daemon with databases from /data/mysql
刪除空使用者
[root@monser mysql]# /service/mysql/bin/mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.5.34-log ZWCCopyright (c) 2009-2013 Percona LLC and/or its affiliatesCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> grant all privileges on *.* to 'root'@'127.0.0.1' identified by 'root' with grant option;Query OK, 0 rows affected (0.00 sec)mysql> grant all privileges on *.* to 'root'@'localhost' identified by 'root' with grant option;Query OK, 0 rows affected (0.00 sec)mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;Query OK, 0 rows affected (0.00 sec)mysql> delete from mysql.user where Password='';Query OK, 4 rows affected (0.00 sec)mysql> delete from mysql.db where User='';Query OK, 2 rows affected (0.00 sec)mysql> delete from mysql.proxies_priv where Host!='localhost';Query OK, 1 row affected (0.00 sec)mysql> show engines;+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+| Engine | Support | Comment | Transactions | XA | Savepoints |+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+| InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES || MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO || CSV | YES | CSV storage engine | NO | NO | NO || BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO || MyISAM | YES | MyISAM storage engine | NO | NO | NO || PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO || ARCHIVE | YES | Archive storage engine | NO | NO | NO || MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO || FEDERATED | YES | Federated MySQL storage engine | NO | NO | NO |+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+9 rows in set (0.00 sec)mysql> exitBye[root@monser mysql]# /service/mysql/bin/mysqlERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)[root@monser mysql]# /service/mysql/bin/mysql -uroot -pEnter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)[root@monser mysql]# /service/mysql/bin/mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 6Server version: 5.5.34-log ZWCCopyright (c) 2009-2013 Percona LLC and/or its affiliatesCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.