mysql
https://db-engines.com/en/ranking
遠(yuǎn)程授權(quán)問(wèn)題:
https://blog.csdn.net/zhangfan_12871/article/details/77941386
oldguo簡(jiǎn)書(shū)
http://www.itdecent.cn/p/dd7137c4efa5?tdsourcetag=s_pcqq_aiomsg
下面是安裝步驟:
[root@localhost app]# mkdir /app/
[root@localhost app]# cd app/
[root@localhost app]# tar -xvf mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz
2.解壓并改名為mysql
[root@db01?app]#?mv?mysql-5.7.20-linux-glibc2.12-x86_64?mysql
[root@db01?app]#?ls?-l?/app/mysql/
[root@localhost mysql]# vim /etc/profile
export PATH=/app/mysql/bin:$PATH
[root@localhost mysql]# useradd mysql
[root@localhost mysql]# mkdir /data/mysql -p
[root@localhost mysql]#? chown -R mysql.mysql /app/*
[root@localhost mysql]#? chown -R mysql.mysql /data/*
第一種初始化方法:安全機(jī)制較高
5.7開(kāi)始,MySQL加入了全新的 密碼的安全機(jī)制:
1.初始化完成后,會(huì)生成臨時(shí)密碼(顯示到屏幕上,并且會(huì)往日志中記一份)
2.密碼復(fù)雜度:長(zhǎng)度:超過(guò)12位? 復(fù)雜度:字符混亂組合
3.密碼過(guò)期時(shí)間180天
[root@localhost mysql]# mysqld --initialize --user=mysql --basedir=/app/mysql --datadir=/data/mysql
2019-04-18T11:21:29.019068Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-04-18T11:21:30.862403Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-04-18T11:21:31.041995Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-04-18T11:21:31.105659Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this serverhas been started. Generating a new UUID: 1db3ce3d-61cc-11e9-b9cf-000c293b5597.
2019-04-18T11:21:31.107276Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-04-18T11:21:31.109162Z 1 [Note] A temporary password is generated for root@localhost: kcre+CtLj0zh
第二種初始化方法:安全機(jī)制一般
初始化數(shù)據(jù),初始化管理員的密碼為空
[root@localhost data]# rm -rf mysql/*
[root@localhost data]# mysqld --initialize-insecure? --user=mysql --basedir=/app/mysql --datadir=/data/mysql
2019-04-18T11:38:04.560602Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-04-18T11:38:06.740715Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-04-18T11:38:06.976313Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-04-18T11:38:07.040330Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this serverhas been started. Generating a new UUID: 6f53608b-61ce-11e9-91c8-000c293b5597.
2019-04-18T11:38:07.041920Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-04-18T11:38:07.043794Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
初始化完了之后在/data/mysql目錄下能看到這些文件
[root@localhost mysql]# pwd
/data/mysql
[root@localhost mysql]# ll
total 110628
-rw-r-----. 1 mysql mysql? ? ? 56 Apr 18 19:38 auto.cnf
-rw-r-----. 1 mysql mysql? ? ? 419 Apr 18 19:38 ib_buffer_pool
-rw-r-----. 1 mysql mysql 12582912 Apr 18 19:38 ibdata1
-rw-r-----. 1 mysql mysql 50331648 Apr 18 19:38 ib_logfile0
-rw-r-----. 1 mysql mysql 50331648 Apr 18 19:38 ib_logfile1
drwxr-x---. 2 mysql mysql? ? 4096 Apr 18 19:38 mysql
drwxr-x---. 2 mysql mysql? ? 8192 Apr 18 19:38 performance_schema
drwxr-x---. 2 mysql mysql? ? 8192 Apr 18 19:38 sys
添加配置文件:
[root@localhost mysql]# cat /etc/my.cnf
[mysqld]
user=mysql
basedir=/app/mysql
datadir=/data/mysql
server_id=6
port=3306
socket=/tmp/mysql.sock
[mysql]
socket=/tmp/mysql.sock
prompt=3306 [\\d]>
[root@localhost mysql]# cp /app/mysql/support-files/mysql.server? /etc/init.d/mysqld
[root@localhost mysql]# service mysqld stop
Shutting down MySQL.. SUCCESS!
設(shè)置下面的內(nèi)容便可以使用systemctl使用mysql了
vim?/etc/systemd/system/mysqld.service?
[Unit]
Description=MySQL?Server
Documentation=man:mysqld(8)
Documentation=
http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/app/mysql/bin/mysqld?--defaults-file=/etc/my.cnf
LimitNOFILE?=?5000
[root@localhost mysql]# mysqladmin -uroot -p password 123