标签:ora sam uri yum lin star mariadb safe ystemd
安装
yum install -y mariadb mariadb-server
systemctl start mariadb
mysql -u root
set password=password(‘密码‘)
设置权限
use mysql
delete from user where password=‘‘
update user set host=‘%‘ #设置远程可以访问
flush privileges;
如果远程访问不了,请检查防火墙
查看方式 systemctl status firewalld
停止及取消开机自动启动
systemctl disable firewalld
systemctl stop firewalld
安装完毕
修改数据库存放位置
分三个步骤
1、配置my.cnf 位置/etc/my.cnf
[mysqld]
datadir=/vdata/mysql_data/
socket=/vdata/mysql_data/mysql.sock
wait_timeout=2880000 #优化
max_allowed_packet=128M #优化
interactive_time=280000 #优化
thread_concurrency=20 #优化
max_connections=1500 #优化
max_connect_errors=30 #优化
table_open_cache=1024 #优化
myisam_sort_buffer_size=32M #优化
bulk_insert_buffer_size=32M #优化
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
2、配置server.cnf 位置/etc/my.cnf.d/server.cnf
[mysqld]
datadir=/vdata/mysql_data/
socket=/vdata/mysql_data/mysql.sock
3、配置client /etc/my.cnf.d/client.cnf
[mysqld]
socket=/vdata/mysql_data/mysql.sock
配置数据库到/vdata/mysql_data 完毕。
重新启动mariadb
systemctl restart mariadb
如果启动不了
请检查/etc/selinux/config,enforinng是否是disable,如果不是改为disable
chmod -R mysql:mysql /vdata/mysql_data #为mysql数据库目录设置权限
以后再优化
标签:ora sam uri yum lin star mariadb safe ystemd
原文地址:https://www.cnblogs.com/hanbinglengxie/p/11330027.html