MariaDB 初步使用:
root@www ~]# tar xf mariadb-5.5.46.tar.gz -C /usr/local/ [iyunv@www ~]# cd /usr/local/
软连接到mysql
[iyunv@www local]# ln -sv mariadb-5.5.46 mysql `mysql' -> `mariadb-5.5.46' [iyunv@www local]# Mysql配置文件:/etc/my.cnf ----->/etc/mysql/my.cnf ---->~/.my.cnf
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 [iyunv@www mysql]# mkdir /etc/mysql [iyunv@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 禁止做反解 [iyunv@www mysql]# scripts/mysql_install_db --user=mysql --datadir=/data/mydata/ 结果,创建数据库文件: [iyunv@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 [iyunv@www mysql]# 编辑配置文件: vim /etc/mysql/my.cnf thread_concurrency = 8 线程并发数 cpu *2 datadir = /data/mydata/mariadb innodb_file_per_table = on 复制启动脚本: [iyunv@www mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld [iyunv@www mysql]# chmod +x /etc/rc.d/init.d/mysqld
将二进程文件写到环境变量里: [iyunv@www mysql]# vim /etc/profile.d/mysql.sh export PATH=/usr/local/mysql/bin:$PATH 启动:service mysqld start [iyunv@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 &
|