MariaDB 初步使用:
[root@www ~]# tar xf mariadb-5.5.46.tar.gz -C /usr/local/ [root@www ~]# cd /usr/local/
软连接到mysql
[root@www local]# ln -sv mariadb-5.5.46 mysql `mysql' -> `mariadb-5.5.46' [root@www local]#
创建mysql账号
groupadd -r -g 306 mysql useradd -r -g 306 -u 306 mysql
cd /usr/local/mysql chown -R root.mysql ./* mkdir -pv /data/mydata chown -R mysql.mysql /data/mydata/mariadb
复制配置文件: [root@www mysql]# mkdir /etc/mysql [root@www mysql]# cp support-files/my-large.cnf /etc/mysql/my.cnf
初始化mysql
mysql_install_db构建数据字典
--datadir=path The path to the MariaDB data directory.
--user=user_name
--defaults-extra-file=name 指定非标准路径。
--skip-name-resolve 禁止做反解
[root@www mysql]# scripts/mysql_install_db --user=mysql --datadir=/data/mydata/
结果,创建数据库文件:
[root@www mysql]# ls /data/mydata/mariadb/ aria_log.00000001 mysql mysql-bin.000002 performance_schema aria_log_control mysql-bin.000001 mysql-bin.index test [root@www mysql]#
编辑配置文件:
vim /etc/mysql/my.cnf thread_concurrency = 8 线程并发数 cpu *2 datadir = /data/mydata/mariadb innodb_file_per_table = on
复制启动脚本:
[root@www mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld [root@www mysql]# chmod +x /etc/rc.d/init.d/mysqld
将二进程文件写到环境变量里:
[root@www mysql]# vim /etc/profile.d/mysql.sh export PATH=/usr/local/mysql/bin:$PATH
启动:service mysqld start
[root@www mysql]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.40-MariaDB-log MariaDB Server Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> MariaDB [(none)]> select version(); +--------------------+ | version() | +--------------------+ | 5.5.40-MariaDB-log | +--------------------+ 1 row in set (0.00 sec)
官方安装步骤:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &