您的位置:首页 > 数据库 > MariaDB

MariaDB 二进制安装步骤

2015-10-27 03:37 555 查看
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
初始化mysqlmysql_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 mysqlshell> useradd -g mysql mysqlshell> cd /usr/localshell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -shell> ln -s full-path-to-mysql-VERSION-OS mysqlshell> cd mysqlshell> chown -R mysql .shell> chgrp -R mysql .shell> scripts/mysql_install_db --user=mysqlshell> chown -R root .shell> chown -R mysql datashell> bin/mysqld_safe --user=mysql &
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mariadb