cd /usr/local/src wget https://downloads.mariadb.com/MariaDB/mariadb-10.2.6/bintar-linux-glibc_214-x86_64/mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb cd /usr/local/mariadb ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb cp support-files/my-small.cnf /usr/local/mariadb/my.cnf vi /usr/local/mariadb/my.cnf //mysqld下定义datadir //这里更改调优和主从。 cp support-files/mysql.server /etc/init.d/mariadb vim /etc/init.d/mariadb //定义basedir、datadir、conf以及启动参数 conf 指定配置文件所在路径 conf=$basedir/my.cnf或者conf=/usr/local/mariadb/my.cnf 如果服务器只装了mariadb,那么my.cnf就可以装在/etc下,启动脚本就不需要定义conf变量了。 在搜索start启动脚本 $bindir/mysqld_safe --defaults-file="$conf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" &

/etc/init.d/mariadb start ps -aux|grep mariadb

ls support-files/ binary-configure my-large.cnf mysql-log-rotate wsrep_notify magic my-medium.cnf mysql.server my-huge.cnf my-small.cnf policy my-innodb-heavy-4G.cnf mysqld_multi.server wsrep.cnf

my-small.cnf //根据内存的大小选择。它们的区别在于缓存的大小不一样。