Configuring the Yum Source
1. Enter the/ETC/YUM.REPOS.D/CD/ETC/YUM.REPOS.D/2. Remove all files from the file or move it to an empty directory, and the personal suggestion is to delete it directly. RM-RF * 3. Create a Yum source profile, "Note: The suffix must be repo" touch Base.repo 4. Add a few lines to the file configure Vim base.repo# disc source [base] Name=centos-6.9base Url=http://mirrors.aliyun.com/centos/6/os/x86_64/gpgcheck=0enable=1#epel Source [epel]name=centos-epelbaseurl=http:// Mirrors.aliyun.com/epel/6/x86_64/gpgcheck=0enable=14. See if a yum source has been generated [[email protected] yum.repos.d]# Yum Repolistloaded Plugins:fastestmirror, Refresh-packagekit, securityloading mirror speeds from cached hostfilebase | 3.7 KB 00:00 Epel | 4.7 KB 00:00 epel/primary_db | 6.0 MB 00:15 Repo ID repo name statusbase centos-6.9 6,706epel Centos-epel 12,449repolist:19,155
1. Install dependent packages
yum groupinstall "development tools" #开发包组 yum install cmake ncurses-devel libaio-devel openssl-devel -y
2, extract mariadb to R ' N Temp directory
tar vxf mariadb-10.2.12.tar.gz -C /app/sdb
3, enter/app/sdb/mariadb-10.2.12 directory to start compiling
cd /app/sdb/mariadb-10.2.12cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb-10.2.12 -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_DEBUG=0 make -j 4 && make install
4. Create a soft connection MySQL mariadb directory after decompression
ln -s mariadb-10.2.12/ mysql
5, create user MySQL system account
useradd -r -s /sbin/nologin mysql
6. Modify the owner of the MySQL folder to drink the genus Group
chown -R mysql.mysql /usr/local/mysql/
7, add Path variable
echo ‘PATH=/usr/local/mysql/bin:$PATH‘ >> /etc/profile.d/mysql.sh检查文件#cat /etc/profile.d/mysql.sh加载环境变量文件 并检查#source /etc/profile.d/mysql.sh#echo $PATH#mysql -Vmysql Ver 15.1 Distrib 10.2.12-MariaDB, for Linux (x86_64) using readline 5.1
8. Create a database Hosting folder and Modify permissions
mkdir -pv /data/sqldb/3306/{log,data,pid,socket,tmp}chown -R mysql.mysql /data/sqldb/chmod -R 770 /data/sqldb/
9. Copy the Master profile my.cnf
"这里先要确认下本机的内存多少,以便使用一个参考模板."grep memory support-files/*找到适合本机内存的模板图片本机内存为1G,所以选择了my-huge.cnf这个配置文件#\cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf
10. Modify the configuration file
[mysqld]port = 3306socket = /tmp/mysql.sockpid-file =/data/sqldb/3306/pid/mysql.piddatadir =/data/sqldb/3306/datatmpdir =/data/sqldb/3306/tmp
11. Install Database related files
mysql_install_db --defaults-file=/etc/my.cnf --user=mysql"这时候会在/data/sqldb/3306/data目录下生成一些文件"[[email protected] support-files]# ls /data/sqldb/3306/data/mysql mysql-bin.000001 mysql-bin.000002 mysql-bin.index test
12, Copy Service script to/etc/init.d/directory and rename to Mysqld
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
13, add mysqld service script to boot automatically, and start mysqld service
chkconfig --add mysqldchkconfig --list mysqldmysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:offservice mysqld start
14. Run the security script
"mysql_secure_installation"第一项问你:输入root密码 回车即可,因为没有第二项问你:需要设置root密码么,当然要 敲Y第三项问你:需要删除空账号用户么,当然要 敲Y第四项问你:禁止root用户远程登入么,根据你们公司的需要第五项问你:需要删除test测试数据哭么,我不需要第六项问你:现在重新加载权限表吗 ,当然
Installation complete .....
CentOS-6.9 Compiling and installing mariadb10.2