首页 > 数据库 > 文库 > 正文

mariadb 安置步骤

2024-09-07 22:12:31
字体:
来源:转载
供稿:网友
      ## [client]
      port  = 3306
      socket = /data/mysql/data/mysql.sock
 
     [mysql]
     prompt = "/u@rac2 /R:/m:/s [/d]> "
 
[mysqld]
user    = mysql
port    = 3306
basedir = /opt/mysql
datadir = /data/mysql/data
socket  = /data/mysql/data/mysql.sock
 
slow_query_log = 1
slow_query_log_file = /data/mysql/data/slow.log
log-error = /data/mysql/data/error.log
long_query_time = 0.5
log_queries_not_using_indexes =1
log_throttle_queries_not_using_indexes = 60
 
log_slow_admin_statements = 1
log_slow_slave_statements = 1
server-id = 3306
log-bin = /data/mysql/data/mybinlog
sync_binlog = 1
expire_logs_days = 30
 
transaction_isolation = REPEATABLE-READ
innodb_buffer_pool_size =50M
innodb_buffer_pool_instances = 1
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
#innodb_data_file_path = ibdata1:50M:autoextend
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 32M
innodb_log_file_size = 50M
innodb_log_files_in_group = 2
innodb_max_undo_log_size = 200M
 
 
###
alias mysql3306='/opt/mysql/bin/mysql [mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=0
enabled=1
yum install boost
yum install MariaDB-server MariaDB-client
sudo systemctl start mariadb
sudo /etc/init.d/mysql start
 
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/data/mariadb/data/mysqld.pid
export PATH=$PATH:/usr/local/mysql
 
chown -R mysql /data/mariadb
  
## mysql升级方法
 
1.在目标服务器上安装新版本的 MySQL
2.在新版本 MySQL 上创建和老版本同名的数据库
mysqladmin -h hostname -P port -u user -p passwd create db_name
3.将老版本 MySQL 上的数据库通过管道导入到新版本数据库中。命令如下:
mysqldump --opt db_name | mysql -h hostname -P port -u user -p passwd
db_name
  
4.将旧版本 MySQL 中的 mysql 数据库目录全部 cp 过来覆盖新版本 MySQL 中的 mysql 数据库
 
#配置GTID
mysqld_safe --gtid_mode=ON --log-bin --log-slave-updates --enforce-gtid-consistency &
./bin/mysqld_safe --defaults-file=/data/opt/mysql/my.cnf --user=mysql --gtid_mode=ON --log-bin --log-slave-updates &
 

(编辑:武林网)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表