mysql二进制安装包可以快速搭建好测试mysql,安装包大小200M多。
# [root@oel1 mysql]# ll -h /data/pkg/mariadb-10.0.10-linux-x86_64.tar.gz
-rw-r--r-- 1 root root 283M 2月 16 07:39 /data/pkg/mariadb-10.0.10-linux-x86_64.tar.gz
安装过程:
解压安装包到指定目录
# tar xf mariadb-10.0.10-linux-x86_64.tar.gz -C /usr/local
# ln -s /usr/local/mariadb-10.0.10 /usr/local/mysql
# cd /usr/local/mysql
准备mysql用户以及目录属主,属组
# groupadd mysql && useradd mysql
# chown -R mysql.root /usr/local/mysql
# mkdir -p /data/{mysqldata,mysqllogs}
# chown -R mysql.mysql /data/mysqldata
# chown -R mysql.mysql /data/mysqllogs
准备配置文件
# mv /etc/my.cnf /etc/my.cnf.bk
# cp support-files/mysql.server /etc/init.d/mysqld
# cp support-files/my-large.cnf /etc/my.cnf
# vi /etc/my.cnf
# datadir=/data/mysqldata
# basedir=/usr/local/mysql
# innodb_file_per_table = on
# skip_name_resolve=on
# log-bin=/data/mysqllogs/mysql-bin
# sql-mode=TRADITIONAL
启动服务
# ./scripts/mysql_install_db --user=mysql --group=mysql --datadir=/data/mysqldata --basedir=/usr/local/mysql
# chkconfig --add mysqld
# service mysqld start
添加命令path路径
# vi /etc/profile.d/mysql.sh
# export PATH=/usr/local/mysql/bin:$PATH
# source /etc/profile.d/mysql.sh
登陆数据库,基本设置
# mysql
# 1、修改root用户密码
# 2、删除空用户
# 3、添加访问权限
mysql配置文件
datadir=/datadisk/mysqldata/data
socket=/var/lib/mysql/mysql.sock
innodb_file_per_table=on
log-bin=/datadisk/mysqldata/binlog
server-id=101
back_log=210
max_connections=800
character_set_server=GBK
innodb_flush_log_at_trx_commit=2
innodb_read_io_threads=4
innodb_write_io_threads=4
innodb_strict_mode=on
lower_case_table_names=1
max_allowed_packet=1073741824
max_connect_errors=999999999
open_files_limit=102400
slow_launch_time=1