2019-04-19

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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1.A simple master-to-slave replication is currently being...
    Kevin關(guān)大大閱讀 6,254評(píng)論 0 3
  • 1)介紹 PerconaXtraBackup(簡(jiǎn)稱PXB)是Percona公司開(kāi)發(fā)的一個(gè)用于MySQL數(shù)據(jù)庫(kù)物理熱...
    溫東閱讀 2,812評(píng)論 0 6
  • 公司:38磁療飾品--林艷--378期反省一組塾生 439期志工,【日精進(jìn)打卡第349天】 【知-學(xué)習(xí)】 《六項(xiàng)精...
    林艷的閱讀 263評(píng)論 0 0
  • 世人皆論油膩中年男,在大眾印象中的人到中年就是油膩的,低俗的,其實(shí)不然。 人到中年,應(yīng)該要活得真實(shí)...
    阿飛的窩閱讀 253評(píng)論 0 1
  • 個(gè)人膚質(zhì):干性皮膚,目前的膚質(zhì)是接近中性皮膚,沒(méi)有任何皮膚問(wèn)題,正在努力往最好的膚質(zhì)前進(jìn)。 我們也不說(shuō)太多,直接進(jìn)...
    貝貝LL閱讀 266評(píng)論 0 0

友情鏈接更多精彩內(nèi)容