标题索引
- 问题追朔
- 安装程序
- 安装总结
问题追朔
Mariadb在生产环境中部署方式较多,同时也是构建数据库集群方案的基本功,因此记录二进制安装mysql是迈向数据库集群的第一步,需谨慎安装配置。
安装程序
安装程序具体如下:
[ [email protected] ~ ]#useradd -r -u 306 -s /sbin/nologin mysql [ [email protected] ~ ]#tar xvf mariadb-10.2.9-linux-x86_64.tar.gz -C /usr/local/ [ [email protected] ~ ]#cd /usr/local [ [email protected] local ]#ln -s mariadb-10.2.9-linux-x86_64 mysql [ [email protected] local ]#chown -R root:mysql ./mysql/* [ [email protected] local ]#chown -R root:mysql ./mysql/ [ [email protected] local ]#ll total 44 drwxrwxr-x 12 1021 1004 4096 Sep 26 04:37 mariadb-10.2.9-linux-x86_64 lrwxrwxrwx 1 root mysql 27 Nov 21 21:36 mysql -> mariadb-10.2.9-linux-x86_64 #安装指定数据库目录和运行时账户 [ [email protected] mysql ]#scripts/mysql_install_db --datadir=/data --user=mysql [ [email protected] mysql ]#cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld [ [email protected] mysql ]#mkdir /etc/mysql [ [email protected] mysql ]#cp ./support-files/my-large.cnf /etc/mysql/my.cnf [ [email protected] mysql ]#vim /etc/mysql.cnf #添加指定数据库存储目录 datadir = /data innodb_file_per_table = on skip_name_resolve = on [ [email protected] mysql ]#vim /etc/profile.d/mysql.sh PATH=/usr/local/mysql/bin:$PATH [ [email protected] mysql ]#source /etc/profile.d/mysql.sh #添加日志访问权限 [ [email protected] mysql ]#setfacl -m u:mysql:rwx /var/log/ [ [email protected] mysql ]#chkconfig --add mysqld [ [email protected] mysql ]#chkconfig --list mysqld mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
安装总结
第一步:准备数据目录
/data
第二步:配置maiadb
#useradd -r -u 306 -s /sbin/nologin mysql #tar xvf mariadb-10.2.9-linux-x86_64.tar.gz -C /usr/local/ #cd /usr/local #ln -s mariadb-10.2.9-linux-x86_64 mysql #chown -R root:mysql ./mysql/* #chown -R root:mysql ./mysql/ #scripts/mysql_install_db --datadir=/data --user=mysql #cp ./support-files/mysql.server /etc/rc.d/init.d/mysql #setfacl -m u:mysql:rwx /var/log/
第三步:准备配置文件
配置文件查找顺序如下,
/etc/my.cnf -->/etc/mysql/my.cnf --> --default-extra-file=/PATH/TO/CONF_FILE --> ~/.my.cnf
第四步:编辑环境变量配置文件
#vim /etc/profile.d/mysql.sh PATH=/usr/local/mysql/bin:$PATH #source /etc/profile.d/mysql.sh
时间: 2024-10-30 08:22:41