标签:type 准备 moni 系统 程序 版本 chown 逻辑 word
MySQL系列官方文档
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
二进制格式安装过程
(1) 准备用户
#useradd -s /sbin/nologin -r mysql
(2) 准备数据目录,建议使用逻辑卷
#mkdir /data/mysql -pv
#chown mysql:mysql /data/mysql
(3) 准备二进制程序
#tar xvf mariadb-10.2.22-linux-x86_64.tar.gz -C /usr/local/ //事先下载好二进制安装包
#cd /usr/local/
#ln -sv mariadb-10.2.22-linux-x86_64/ mysql
#chown -R root:mysql /usr/local/mysql/
(4) 准备配置文件
#mkdir /etc/mysql/
#cp /usr/local/mysql/support-files/my-huge.cnf /etc/mysql/my.cnf
#vim /etc/mysql/my.cnf
[mysqld]中添加三个选项
datadir=/data/mysql
innodb_file_per_table = on
skip_name_resolve = on //禁止主机名解析,建议使用
(5) 创建数据库文件
#cd /usr/local/mysql
#./scripts/mysql_install_db --datadir=/data/mysql/ --user=mysql
(6) 准备服务脚本,并启动服务
#cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
#chkconfig --add mysqld
#service mysqld start (或者 /etc/rc.d/init.d/mysqld start )
(7) 配置maria环境变量
#echo ‘PATH=/usr/local/mysql/bin:$PATH‘ >> /etc/profile.d/env.sh
#source /etc/profile.d/env.sh
(8) 安全加固
#cd /usr/local/mysql
#./bin/mysql_secure_installation
或者执行下面任意命令给root用户加密
#./bin/mysqladmin‘ -u root password ‘root‘
#./bin/mysqladmin‘ -u root -h centOS6.magedu.com password ‘root‘
(9) 登陆mariadb数据库
[root@centOS6 mysql]#mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.2.22-MariaDB-log MariaDB Server
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)]>
MariaDB [(none)]> select version();
+---------------------+
| version() |
+---------------------+
| 10.2.22-MariaDB-log |
+---------------------+
1 row in set (0.00 sec)
标签:type 准备 moni 系统 程序 版本 chown 逻辑 word
原文地址:http://blog.51cto.com/8845692/2350917