我们专注攀枝花网站设计 攀枝花网站制作 攀枝花网站建设
成都网站建设公司服务热线:400-028-6601

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

PerconaMySQL5.5Linux通用二进制包安装(CentOS6.9)

创建软件安装目录
mkdir  /MySQL_software_55

下载软件
Percona官网的下载页面有两个二进制Tar包,分别对应不同的发行版本
ssl100 - Debian/Ubuntu
ssl101 - for CentOS 6 and CentOS 7

解压安装包
tar xvfz Percona-Server-5.5.58-rel38.10-Linux.x86_64.ssl101.tar.gz -C /mysql_software_55/

创建mysql用户
useradd mysql

创建数据目录、日志目录和临时目录
mkdir -p /mysql_55_3306/data
mkdir -p /mysql_55_3306/log
mkdir -p /mysql_55_3306/tmp

创建错误日志
touch /mysql_55_3306/log/error.log

chown -R mysql.mysql /mysql_55_3306

编辑配置文件
vim /etc/my_55_3306.cn

  1. [client]
    port = 3306
    socket = /mysql_55_3306/tmp/mysql.sock

    # The MySQL server
    #######Basic#######
    [mysqld]
    server-id = 101
    port = 3306
    user = mysql
    basedir = /mysql_software_55/
    datadir = /mysql_55_3306/data
    tmpdir = /mysql_55_3306/tmp
    socket = /mysql_55_3306/tmp/mysql.sock
    skip-external-locking
    skip-name-resolve
    default-storage-engine = INNODB
    character-set-server = utf8
    wait_timeout = 100
    connect_timeout = 20
    interactive_timeout = 100
    back_log = 500
    myisam_recover
    event_scheduler = ON

    #######binlog#######
    log-bin = /mysql_55_3306/log/mysql-bin
    binlog_format = row
    max_binlog_size = 128M
    binlog_cache_size = 2M
    expire-logs-days = 5

    #######replication#######
    slave-net-timeout = 10
    #rpl_semi_sync_master_enabled =1
    #rpl_semi_sync_master_wait_no_slave = 1
    #rpl_semi_sync_master_timeout = 1000
    #rpl_semi_sync_slave_enabled = 1
    skip-slave-start
    log_slave_update = 1
    relay_log_recovery = 1

    #######slow log#######
    slow_query_log = 0
    slow_query_log_file = /mysql_55_3306/log/mysql_slow.log
    long_query_time = 2


    #######error log#######
    log-error = /mysql_55_3306/log/error.log
    general_log = 0
    general_log_file = /mysql_55_3306/log/general_query.log


    #######per_thread_buffers########
    max_connections = 1024
    max_user_connections = 1000
    max_connect_errors = 10000
    key_buffer_size = 10M
    max_allowed_packet = 128M
    table_cache = 3096
    table_open_cache = 6144
    table_definition_cache = 4096
    sort_buffer_size = 512K
    read_buffer_size = 512K
    read_rnd_buffer_size = 512K
    join_buffer_size = 512K
    tmp_table_size = 64M
    max_heap_table_size = 64M
    query_cache_type = 0
    query_cache_size = 0
    bulk_insert_buffer_size = 32M
    thread_cache_size = 64
    thread_concurrency = 32
    thread_stack = 256K

    #######InnoDB#######
    innodb_data_home_dir = /mysql_55_3306/data
    innodb_log_group_home_dir = /mysql_55_3306/log
    innodb_data_file_path = ibdata1:2G:autoextend
    innodb_buffer_pool_size = 128M
    innodb_buffer_pool_instances = 1
    innodb_additional_mem_pool_size = 2M
    innodb_log_file_size = 512M
    innodb_log_buffer_size = 10M
    innodb_log_files_in_group = 3
    innodb_flush_log_at_trx_commit = 2
    innodb_lock_wait_timeout = 10
    innodb_sync_spin_loops = 40
    innodb_max_dirty_pages_pct = 90
    innodb_support_xa = 1
    innodb_thread_concurrency = 0
    innodb_thread_sleep_delay = 500
    innodb_file_io_threads = 4
    innodb_concurrency_tickets = 1000
    log_bin_trust_function_creators = 1
    innodb_flush_method = O_DIRECT
    innodb_file_per_table
    innodb_read_io_threads = 16
    innodb_write_io_threads = 16
    innodb_io_capacity = 2000
    innodb_file_format = Barracuda
    innodb_purge_threads = 1
    innodb_purge_batch_size = 32
    innodb_old_blocks_pct = 75
    innodb_change_buffering = all
    transaction_isolation = READ-COMMITTED

初始化MySQL数据库的数据文件路径,并且创建系统表
删除Percona-Server-5.5.58-rel38.10-Linux.x86_64.ssl101目录,将软件文件移动到上一级目录,否则初始化的时候会报错
cd /mysql_software_55/Percona-Server-5.5.58-rel38.10-Linux.x86_64.ssl101
[root@MySQL01 Percona-Server-5.5.58-rel38.10-Linux.x86_64.ssl101]# mv * ..
[root@MySQL01 Percona-Server-5.5.58-rel38.10-Linux.x86_64.ssl101]# cd ..
[root@MySQL01 mysql_software_55]# rmdir Percona-Server-5.5.58-rel38.10-Linux.x86_64.ssl101/

执行初始化
[root@MySQL01 mysql_software_55]# ./scripts/mysql_install_db --user=mysql  --basedir=/mysql_software_55/ --datadir=/mysql_55_3306/data/
WARNING: The host 'MySQL01' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
171214  9:56:46 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
171214  9:56:46 [Note] /mysql_software_55//bin/mysqld (mysqld 5.5.58-38.10) starting as process 9175 ...
OK
Filling help tables...
171214  9:56:47 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
171214  9:56:47 [Note] /mysql_software_55//bin/mysqld (mysqld 5.5.58-38.10) starting as process 9182 ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/mysql_software_55//bin/mysqladmin -u root password 'new-password'
/mysql_software_55//bin/mysqladmin -u root -h MySQL01 password 'new-password'

Alternatively you can run:
/mysql_software_55//bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /mysql_software_55/ ; /mysql_software_55//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /mysql_software_55//mysql-test ; perl mysql-test-run.pl

Please report any problems at
  https://bugs.launchpad.net/percona-server/+filebug

Percona recommends that all production deployments be protected with a support
contract (http://www.percona.com/mysql-suppport/) to ensure the highest uptime,
be eligible for hot fixes, and boost your team's productivity.

启动 MySQL
[root@MySQL01 mysql_software_55]# bin/mysqld_safe --defaults-file=/etc/my_55_3306.cn &
[1] 21953

[root@MySQL01 mysql_software_55]# ps -ef|grep mysql
root     10302 10278  0 10:11 pts/1    00:00:00 su - mysql
mysql    10303 10302  0 10:11 pts/1    00:00:00 -bash
mysql    21952 10303  0 10:45 pts/1    00:00:00 tailf error.log
root     21953  1960  0 10:45 pts/0    00:00:00 /bin/sh bin/mysqld_safe --defaults-file=/etc/my_55_3306.cn
mysql    23005 21953  0 10:45 pts/0    00:00:00 /mysql_software_55/bin/mysqld --defaults-file=/etc/my_55_3306.cn --basedir=/mysql_software_55/ --datadir=/mysql_55_3306/data --plugin-dir=/mysql_software_55//lib/mysql/plugin --user=mysql --log-error=/mysql_55_3306/log/error.log --pid-file=/mysql_55_3306/data/MySQL01.pid --socket=/mysql_55_3306/tmp/mysql.sock --port=3306
root     23051  1960  0 10:46 pts/0    00:00:00 grep mysql
网站栏目:PerconaMySQL5.5Linux通用二进制包安装(CentOS6.9)
链接地址:http://shouzuofang.com/article/jigjhh.html

其他资讯