MySQL系列
官方网址:
https://www.mysql.com/
http://mariadb.org/
https://www.percona.com
官方文档
https://dev.mysql.com/doc/
https://mariadb.com/kb/en/
https://www.percona.com/software/mysql-database/percona-server
版本演变:
MySQL:5.1 --> 5.5 --> 5.6 --> 5.7 -->8.0
MariaDB:5.5 -->10.0--> 10.1 --> 10.2 --> 10.3
'========================================================
查看系统里有没有安装mariadb
#rpm -q mariadb-server
1.安装环境
#yum -y install bison bison-devel zlib-devel libcurl-devel libarchive-devel boosdevel gcc gcc-c++ cmake ncurses-devel gnutls-devel libxml2-devel openssl-devel libevent-devel libaio-devel
2.做准备用户和数据目录
#useradd –r –s /sbin/nologin –d /data/mysql/ mysql
#mkdir -pv /data/mysql
#chown mysql.mysql /data/mysql
#tar xvf mariadb-10.2.22.tar.gz //事先下载好mariadb安装包
3.cmake 编译安装
cmake的重要特性之一是其独立于源码(out-of-source)的编译功能,即编译工作可以在
另一个指定的目录中而非源码目录中进行,这可以保证源码目录不受任何一次编译的影
响,因此在同一个源码树上可以进行多次不同的编译,如针对于不同平台编译
编译选项:https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html
#cd mariadb-10.2.22
#cmake . \
-DCMAKE_INSTALL_PREFIX=/app/mysql \
-DMYSQL_DATADIR=/data/mysql/ \
-DSYSCONFDIR=/etc/mysql \
-DMYSQL_USER=mysql \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITHOUT_MROONGA_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0 \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
#make -j 8 && make install && echo -e '\a'
提示:如果出错,执行rm -f CMakeCache.txt
4.准备环境变量
#echo 'PATH=/app/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
#source /etc/profile.d/mysql.sh
5.生成数据库文件
#cd /app/mysql/
#./scripts/mysql_install_db --datadir=/data/mysql/ --user=mysql
6.准备配置文件
#cp /app/mysql/support-files/my-huge.cnf /etc/my.cnf
7.准备启动脚本
#cp /app/mysql/support-files/mysql.server /etc/init.d/mysqld
8.启动服务
#chkconfig --add mysqld
#chkconfig mysqld on
#service mysqld start
9.安全加固
#cd /app/mysql/
#./bin/mysql_secure_installation
or
#./bin/mysqladmin' -u root password 'root'
#./bin/mysqladmin' -u root -h centOS6.magedu.com password 'root'
10.登陆mysql
#mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 10.2.22-MariaDB-log Source distribution
Copyright (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)]> select version();
+---------------------+
| version() |
+---------------------+
| 10.2.22-MariaDB-log |
+---------------------+
1 row in set (0.00 sec)
转载于:https://blog.51cto.com/8845692/2350838