这篇文章主要讲解了“maridb的安装方法”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“maridb的安装方法”吧!
1、创建用户
useradd -u 1000 teledb
passwd teledb
Nihao123,
2、解压文件
tar -zxvf mariadb.tar.gz -C /oracle/mysql/
cd /oracle/mysql/data
mkdir mariadb10_data3306
cd mariadb10_data3306/
mkdir {data,binlog,relaylog,logs,tmp}
cd logs
mkdir {arch,tmp}
vim /home/teledb/.bash_profile
PATH=$PATH:$HOME/bin:/home/teledb/mariadb/bin
修改配置文件:
vim /home/teledb/mariadb/etc/mariadb3306.cnf
参数修改:
server-id=25563306 命名规则:机器ip后两个+端口
gtid-domain-id=5657586 一主两从ip的后一位+端口后一位
innodb_buffer_pool_size=8G 单实例不超过机器内存的80%,双实例加起来不超过机器内存的80% 内存 free -m 查看
innodb_thread_concurrency=6 小于等于cpu线程数 cat /proc/cpuinfo |grep 'processor' | sort -u | wc -l
log_slave_updates 一主两从开启log_slave_updates
report-host=172.31.25.56 修改report_host,改成机器IP
根据实际情况修改个别路径
cd /oracle/mysql/mariadb/
./scripts/mysql_install_db --defaults-file=/oracle/mysql/mariadb/etc/mariadb3306.cnf
启动mariadb
mysqld_safe --defaults-file=/oracle/mysql/mariadb/etc/mariadb3306.cnf &
查看错误日志文件,若无报错则进行下一步
tail -100f /data/mariadb10_data3306/logs/mysql3306.err
========创建数据库==========
create database `immcc_test` default character set utf8 collate utf8_general_ci;
/home/teledb/mariadb/bin/mysql -S /tmp/mysql_3306.sock -uroot -p
用sock连接mariadb,执行以下语句:
/home/teledb/mariadb/bin/mysql -S /tmp/mysql_3306.sock -uroot -p
update mysql.user set password=PASSWORD('123456') where User='root';
delete from mysql.user where user='sh_kd_sh_test';
grant all privileges on immcc_test.* to 'immcc_test'@'%' identified by 'immcc_test';
grant all privileges on *.* to 'root'@'%' identified by '1qaz2WSX';
flush privileges;
create database `sh_kd_zj_test` default character set utf8 collate utf8_general_ci;
grant all privileges on sh_kd_zj_test.* to 'sh_kd_zj_test'@'%' identified by 'sh_kd_zj_test';
flush privileges;
感谢各位的阅读,以上就是“maridb的安装方法”的内容了,经过本文的学习后,相信大家对maridb的安装方法这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!