内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

MySQL:常見使用問題-創(chuàng)新互聯(lián)

1、Linux 上安裝MySQL

安裝步驟:

創(chuàng)新互聯(lián)建站堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站建設(shè)、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的南安網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

1)解壓 tar.gz文件

shell> tar -zxvf mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz

2)初始化默認(rèn)數(shù)據(jù)庫(mysql、performace_schema、sys、information_schema)

在/home/bes/jinuo/mysql 目錄下的結(jié)構(gòu)如下:

MySQL:常見使用問題

/home/bes/jinuo/mysql
                     /mysql-5.7.9-glibc2.5-x86_64
                           /bin
                           /docs
                           /include
                           /lib
                           /man
                           /share
                           /support-files
                    /test
                         /ins1
                              /my-default.cnf

MySQL:常見使用問題

拷貝 support-files 目錄到你想要做mysql實(shí)例的目錄下,并編輯如下:

MySQL:常見使用問題

[mysqld]
basedir=/home/bes/jinuo/mysql/mysql-5.7.9-linux-glibc2.5-x86_64
datadir=/home/bes/jinuo/mysql/test/ins1/datadir
port=36001
server_id=36001
socket=/home/bes/jinuo/mysql/test/ins1/mysql.sock
log-error=/home/bes/jinuo/mysql/test/mysqld.log
explicit_defaults_for_timestamp=true
character-set-server=utf8
collation-server=utf8_general_ci
skip-host-cache
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

MySQL:常見使用問題

然后執(zhí)行如下命令初始化:

普通用戶可以直接執(zhí)行如下命令:

shell> bin/mysql_install_db    # Before MySQL 5.7.6shell> bin/mysqld --initialize   # MySQL 5.7.6 and up

 如果是操作每戶的root用戶創(chuàng)建mysql實(shí)例,創(chuàng)建實(shí)例時(shí),需要指定為哪個(gè)用戶創(chuàng)建的實(shí)例。

也就是說,如果你是一個(gè)普通用戶 hello, 你可以使用上面 的命令直接 創(chuàng)建自己的實(shí)例。

如果要讓root用戶給你創(chuàng)建實(shí)例,需要在上面命令后面加上 --user=hello 參數(shù)。

root用戶:
shell>mysqld --defaults-file=/your/mysql/cnf/path --initialize-insecure --user=username
>mysqld --defaults-=/your/mysql/cnf/path --initialize-insecure

在初始化時(shí),會(huì)為mysql root用戶 創(chuàng)建一個(gè)臨時(shí)密碼。臨時(shí)密碼的位置可以這樣找到:

MySQL:常見使用問題

MySQL 5.6.x :

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.
You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.

MySQL:常見使用問題

MySQL:常見使用問題

MySQL 5.7.x :

如果初始化時(shí)使用的是  --initialize:
# tail -n1 /home/bes/jinuo/mysql/test/ins1/mysqld.log
2016-12-11T07:47:58.199154Z 1 [Note] A temporary password is generated for root@localhost: wzgds/:Kf2,g

如果
初始化時(shí)使用的是  --initialize-insecure:

 # tail -n1 /var/log/mysql/error.log
 2016-12-11T07:51:28.506142Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option

MySQL:常見使用問題

 所以,如果是5.7之上的版本,建議使用  --initialize-insecure方式來創(chuàng)建實(shí)例。這樣就可以直接使用mysqladmin來修改root密碼了。參見4)。

3)啟動(dòng)數(shù)據(jù)庫

啟動(dòng)MySQL Server:

shelll> /home/bes/jinuo/mysql/mysql-5.7.9-linux-glibc2.5-x86_64/bin/mysqld --defaults-file=/home/bes/jinuo/mysql/test/ins1/my-default.cnf &

4)知道密碼情況下,修改密碼

mysqladmin 提供了一套mysql的管理命令,其中有一個(gè)是password命令,用于修改密碼的。使用mysqladmin 來修改密碼的前提是你知道密碼,因?yàn)樗鼉?nèi)部是先使用現(xiàn)有登錄到mysql server,然后修改密碼。

可以直接使用mysqladmin命令來修改密碼。例如修改root密碼,由安裝后的 空密碼修改為 12345678

mysqladmin -u root --socket=/home/bes/mysql/mysql.sock password 12345678

如果在使用過程中,想要更換密碼由12345678變成123456:

mysqladmin -u root -p 12345678 --socket=/home/bes/mysql/mysql.sock password 123456

修改其它用戶的密碼,是同樣 的方式。

5)為root授權(quán)限

mysql> grant all on *.* to 'root'@'%' identified by 'yourRootPassword';

2、單機(jī)多實(shí)例安裝

如果在一臺(tái)機(jī)器上,要安裝多個(gè)mysql實(shí)例,只需要將重復(fù)執(zhí)行 1中的2)3)4)5)就可以了。

3、 不知root密碼情況下,修改root密碼、授權(quán)

該方式適用于,有root密碼,但是不知道root 密碼情況下。

    a: 停止 MySQL Server

    b: 繞過授權(quán)檢查方式啟動(dòng)MySQL Server

shell> /home/bes/jinuo/mysql/mysql-5.7.9-linux-glibc2.5-x86_64/bin/mysqld --defaults-file=/home/bes/jinuo/mysql/test/ins1/my-default.cnf --skip-grant-tables &

    c: root用戶登錄到mysql server上,并切換到mysql 庫

shell> /home/bes/jinuo/mysql/mysql-5.7.9-linux-glibc2.5-x86_64/bin/mysql --socket=/home/bes/jinuo/mysql/test/ins1/mysql.sock -uroot -p

mysql> use mysql;

    d: 修改root 用戶的密碼:

mysql> update mysql.user set authentication_string = password('mypassword') where user = 'root';
mysql> flush privileges;
mysql> quit;

    e: 停止mysql server,正常啟動(dòng)。

    正常啟動(dòng)的方式在前面 3)中已說過。

    f: root 登錄后,進(jìn)行授權(quán)調(diào)整:

shell> /home/bes/jinuo/mysql/mysql-5.7.9-linux-glibc2.5-x86_64/bin/mysql --socket=/home/bes/jinuo/mysql/test/ins1/mysql.sock -uroot -p
Enter Password

mysql> grant all on *.* to 'root'@'%' identified by 'yourRootPassword';

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

分享題目:MySQL:常見使用問題-創(chuàng)新互聯(lián)
URL網(wǎng)址:http://www.rwnh.cn/article30/cspdpo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、App開發(fā)、面包屑導(dǎo)航、營(yíng)銷型網(wǎng)站建設(shè)定制開發(fā)、網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司
左贡县| 敦煌市| 介休市| 河西区| 黄陵县| 巢湖市| 锦州市| 涞水县| 阳泉市| 信宜市| 沛县| 海晏县| 梨树县| 交口县| 康乐县| 北票市| 靖边县| 吴川市| 揭东县| 杂多县| 安岳县| 望都县| 舞钢市| 新建县| 兴化市| 南汇区| 灵武市| 二手房| 藁城市| 绥阳县| 安义县| 安阳市| 徐州市| 新野县| 九龙城区| 武宣县| 五指山市| 福州市| 兴业县| 巴东县| 无为县|