CentOS 6.9 based clang3.4 compilation installation mariadb-10.2.12

Source: Internet
Author: User

System Platform:

CentOS Release 6.9 (Final)

Kernel 2.6.32-696.el6.x86_64

1. Go to the official website to download the appropriate source package

http://mariadb.org/

Mariadb-10.2.12.tar.gz

Check that the database is installed in the system.

#rpm -qa|grep MariaDB#rpm -qa|grep mysql

CMake The latest version requires C++11 support, gcc4.8 is not included below, and the CentOS 6.9 version is as follows

#rpm -qa|grep gccgcc-4.4.7-18.el6.x86_64libgcc-4.4.7-18.el6.x86_64gcc-gfortran-4.4.7-18.el6.x86_64gcc-c++-4.4.7-18.el6.x86_64
2. Compiling with the clang compiler

Clang advantages over the GCC compiler:

编译速度更快编译产出更小出错提示更友好
3. Installing dependent Packages
# yum install cmake ncurses-devel libaio-devel openssl-devel clang -y   #其中clang需要EPEL源,请自行参考https://mirrors.aliyun.com/help/centos#cmake --versioncmake version 2.8.12.2
4. Unzip the MARIADB package to any temporary directory
#tar xvf mariadb-10.2.12.tar.gz -C /app/sdb/
5. Compile and install MARIADB
#mkdir /app/sdb/db-build#cd /app/sdb/db-build/以下的编译参数,根据自己的需求定制#cmake /app/sdb/mariadb-10.2.12  -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我使用的AUSU笔记本是 I5  1CPU 4核,4GB内存,20分钟编译安装完成。# make -j 8 && make install编译完成占用空间为3.3GB
6. Create a soft link MySQL point to the extracted directory
#cd /usr/local/#ln -s mariadb-10.2.12 mysql
7. Create a group and account for MySQL
#groupadd -g 500 mysql#useradd -g 500 -u 500 -s /sbin/nologin -M mysql
8. Modify the MySQL folder owner and owning group
#chown -R mysql.mysql /usr/local/mysql/
9. Add path to environment 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
10. 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/
11. Copy the Master profile my.cnf

This is the first to confirm how much memory is in the machine so that you can use a reference template.

#grep memory support-files/*

Find a template for native memory

The native memory is 512M, so the my-large.cnf configuration file is selected

#\cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
12. Modify the configuration file
# vim /etc/my.cnf[mysqld]port            = 3306socket          = /tmp/mysql.sockpid-file = /data/sqldb/3306/pid/mysql.piddatadir = /data/sqldb/3306/datatmpdir = /data/sqldb/3306/tmpinnodb_file_per_table = 1skip_name_resolve = 1log-error = /data/sqldb/3306/log/error.log
13. Installing database-related files
#cd /usr/local/mysql/

To view the installation parameters for the installation program

#/usr/local/mysql/scripts/mysql_install_db --help#./scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
14. Copy start service script to/etc/init.d directory
#cp support-files/mysql.server /etc/init.d/mysqld
15. Add the boot service and start the MYSQLD service
#chkconfig --add mysqld#service mysqld startStarting MySQL.180128 23:54:38 mysqld_safe Logging to ‘/data/sqldb/3306/log/error.log‘.180128 23:54:38 mysqld_safe Starting mysqld daemon with databases from /data/sqldb/3306/data                                                     [  OK  ]#lsof -i:3306COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAMEmysqld  2067 mysql   21u  IPv6  12603      0t0  TCP *:mysql (LISTEN)
16. Make the Security Configuration
#/usr/local/mysql/bin/mysql_secure_installationEnter current password for root 默认为空Set root password   设置mysql root密码Remove anonymous users  是否移除匿名用户登录Disallow root login remotely    是否禁止root远程登录Remove test database and access to it?  是否移除test数据和test账号Reload privilege tables now?    是否立即更新权限Thanks for using MariaDB!
17. Testing
#mysql -u root -pEnter password: Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 19Server version: 10.2.12-MariaDB-log Source distributionCopyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.MariaDB [(none)]> use mysql;

Set up an account to test Telnet

MariaDB [mysql]> grant all on *.* to ‘hunk‘@‘%‘ identified by ‘123456‘;Query OK, 0 rows affected (0.00 sec)MariaDB [mysql]> flush privileges;Query OK, 0 rows affected (0.00 sec)#mysql -uhunk -p123456 -h192.168.5.128Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 21Server version: 10.2.12-MariaDB-log Source distributionCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.MariaDB [(none)]>

CentOS 6.9 clang3.4-based compilation installation mariadb-10.2.12

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.