CentOS-7.4 Binary Installation mariadb10.2 database

Source: Internet
Author: User

On the official website under the binary installation package
http://mariadb.org #"包名:带有linux字样的就是编译完安装包"mariadb-10.2.12-linux-x86_64.tar.gz
Verify that there are no mariadb related packages in the system
rpm -qa "mariadb*"
Extract the source package to/usr/local This folder "Note: Must be this folder"
tar vxf mariadb-10.2.12-linux-x86_64.tar.gz -C /usr/local/
And then in this directory for this; mariadb-10.2.12-linux-x86_64 create a soft connection name MYSPL Note: This name must be called and must be in this directory/usr/local/
cd  /usr/local/ln -s   ln -s mariadb-10.2.12-linux-x86_64 mysq
Modify the MySQL file owner and the owning group as MySQL user
chown -R mysql:mysql mysql/
Add Path variable
echo ‘PATH=/usr/local/mysql/bin:$PATH‘ > /etc/profile.d/mysql.sh加载PATH变量并,检查source /etc/profile.d/mysql.shecho $PATH
Create a MySQL system user
    useradd -r  -s /sbin/nologin  mysql
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/
Copying 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   
Modifying a 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
Build Database
进到/usr/local/mysql/目录下:注意:必须要在myql这个目录下执行这个命令否则会报错运行scripts/mysql_install_db --datadir=/data/sqldb/3306/ --user=mysql命令选项:  --datadir 指定存放数据库的目录路径             --user     指定用户是谁"这时候会在/data/sqldb/3306/data目录下生成一些文件"[[email protected] support-files]# ls /data/sqldb/3306/data/mysql  mysql-bin.000001  mysql-bin.000002  mysql-bin.index  test
Copy the/usr/local/mysql/support-files service script to the/etc/init.d/directory and change to name Mysqld, and add Chkconfig management, set to boot automatically
1,复制cp  /usr/local/mysql/support-filesmysql.server   /etc/init.d/mysqld2,加入chkconfig管理chkconfig --add mysqld3,设置为开机自动启动chkconfig mysqld on
Start the service
systemctl start mysqld
Running security scripts
"mysql_secure_installation"第一项问你:输入root密码  回车即可,因为没有第二项问你:需要设置root密码么,当然要  敲Y第三项问你:需要删除空账号用户么,当然要  敲Y第四项问你:禁止root用户远程登入么,根据你们公司的需要第五项问你:需要删除test测试数据哭么,我不需要第六项问你:现在重新加载权限表吗 ,当然
Log in command
mysql -u root -p  #-u 指定用户 -p指定密码可以不输,敲回车会在让你输入密码

CentOS-7.4 Binary Installation mariadb10.2 database

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.