Database Brief Introduction
- Oracle Security-perfect operation complex
- DB2 Large-scale security improvement
- MySQL free Open Source Volume small
Experimental environment
- mysql5.7//Database
- BOOST_1_59_0//c++ Environment Library
Yum Install gcc gcc-c++ Nurses ncurses-devel Bison cmake-y//Install build Environment tar ZXVF boost_1_59_0.tar.gz-c/usr/local ///Unzip MV Boost_1_59_0/boost//rename useradd-s/sbin/nologin MySQL//create administrative user tar zxvf mysql-5.7.17.tar.gz-c/mysql///Solution Press to see Personal CD mysql-5.7.17/cmake-dcmake_install_prefix=/usr/local/mysql \//installation directory-DMYSQL_UNIX_ADDR=/USR/LOCAL/MYSQL/MYSQ L.sock \//Link file Communication file-dsysconfdir=/etc \//config file exists directory-dsystemd_pid_dir=/usr/local/mysql \ Process file-ddefault_charset=utf8 \//Supported format Utf-8 character set-ddefault_collation=utf8_general_ci \ Turn on the storage engine-dwith_innobase_storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith _perfschema_storage_engine=1-dmysql_datadir=/usr/local/mysql/data \//database file-dwith_boost=/usr/local/boost \ Support C + + library-dwith_systemd=1//Open Function-NOTE: If there is an error in the process of CMake, when the error is resolved, you need to remove the CMakeCache.txt file from the source directory and then CMake again, otherwise the error is still--
Make && make install//process a bit long patience waiting
- Modify Database directory Permissions
- Chown-r mysql:mysql/usr/local/mysql/
- The MySQL 5.7 version differs from the previous, and the service fails to start if the configuration file is not modified
vim /etc/my.cnf[client] //服务端port = 3306 //开启的端口default-character-set=utf8 ///字符集socket = /usr/local/mysql/mysql.sock /// 同步服务[mysql] //客户端 port = 3306default-character-set=utf8socket = /usr/local/mysql/mysql.sock[mysqld]user = mysqlbasedir = /usr/local/mysqldatadir = /usr/local/mysql/dataport = 3306character_set_server=utf8pid-file = /usr/local/mysql/mysqld.pidsocket = /usr/local/mysql/mysql.sockserver-id = 1sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTESchown mysql:mysql /etc/my.cnf //修改配置文件的权限
- Setting environment variables
echo ‘PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH‘ >> /etc/profileecho ‘export PATH‘ >> /etc/profilesource /etc/profile //使写入生效
Initializing the database
cd /usr/local/mysql/bin/mysqld --initialize-insecure \ //生成初始化密码(5.7版本才有),实际会生成空密码--user=mysql \ //指定管理用户--basedir=/usr/local/mysql \ //指定工作目录--datadir=/usr/local/mysql/data //指定数据文件目录
- Adding system Services
关闭防火墙systemctl disable firewalld.service systemctl stop firewalld.servicesetenforce 0 cp usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/systemctl daemon-reload //刷新识别mysqld.service服务systemctl enable mysqld //加入系统自启动systemctl start mysqld //启动服务netstat -anpt | grep 3306
- Authorize Remote Login Database
- Use grant to elevate root privileges and operate in MySQL database
grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘abc123‘ with grant option;//第一个“*”代表所有数据库,第二“*”代表所有表,赋予root权限 “%”代表所有服务器终端,可设为IP地址 密码为“abc123” //自定义
centos7.3 build MySQL