mariadb安装步骤
下载地址:https://downloads.mariadb.org/mariadb/10.2.10/
##
[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
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
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
参考地址:https://mariadb.com/kb/en/library/yum/
参考地址:
https://downloads.mariadb.org/mariadb/repositories/#mirror=neusoft&distro=CentOS&distro_release=centos6-amd64--centos6&version=10.2
## 源码安装
安装包mariadb-10.2.10.tar
软件目录 /opt/mysql
数据目录 /data/mysql/data
yum install -y ncurses-devel openssl-devel openssl gcc-c++ cmake
groupadd mysql
useradd -g mysql mysql
[mysqld]
datadir=/data/mariadb/data
socket=/data/mariadb/data/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/data/mariadb/data/mysqld.pid
datadir=/data/mariadb/data
socket=/data/mariadb/data/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[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
mysqld_safe --defaults-file=/usr/local/mysql/my.cnf &
登陆mysql
mysql -uroot -p --socket=/data/mariadb/data/mysql.sock
参考文档:https://www.cnblogs.com/daixiang/p/5431639.html
## 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
说明:
--opt 选项表明采用优化(Optimize)方式进行导出
如果网络较慢,可以在导出选项中加上--compress 来减少网络传输
对于不支持管道操作符(|)的操作系统,可以先用 mysqldump 工具将旧版本的数据导出为 文本文件,然后再往新版本 MySQL 中导入此文件
shell> mysqldump --opt db_name > filename(旧版本 MySQL 上执行)
shell> mysql –u user –p passwd db_name < filename(新版本 MySQL 上执行)
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 &
主从配置gtid参考
http://blog.csdn.net/wuxbeyond/article/details/49615359
名称栏目:mariadb安装步骤
文章转载:http://ybzwz.com/article/pojsoe.html