濮阳杆衣贸易有限公司

主頁 > 知識庫 > centos7下安裝mysql6初始化安裝密碼的方法

centos7下安裝mysql6初始化安裝密碼的方法

熱門標簽:咸陽防封電銷卡 廣東400企業(yè)電話申請流程 宜賓全自動外呼系統(tǒng)廠家 臨沂做地圖標注 新鄉(xiāng)智能外呼系統(tǒng)好處 許昌外呼增值業(yè)務(wù)線路 石家莊400電話辦理公司 申請400電話電話價格 地圖標注客戶付款

1.先停止數(shù)據(jù)庫服務(wù)器

service  mysqld stop

2.vim /etc/my.cnf

3.配置文件添加skip-grant-tables

[root@VM_0_8_centos ~]# vim /etc/my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables      此處!?。。。?!
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

4.重啟數(shù)據(jù)庫

 systemctl restart mysql

5.登錄數(shù)據(jù)庫

mysql -uroot -p

如果詢問密碼,直接空密碼登錄

6.set password for root@localhost = password('123456');括號里面的密碼你自己修改。

7.mysql -uroot -p123456 登錄成功

PS:下面看下Mysql初始化root密碼和允許遠程訪問

mysql默認root用戶沒有密碼,輸入mysql –u root 進入mysql

1、初始化root密碼

進入mysql數(shù)據(jù)庫

mysql>update user set password=PASSWORD(‘123456') where User='root';

2、允許mysql遠程訪問,可以使用以下三種方式:

a、改表。

mysql -u root –p
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;

b、授權(quán)。

例如,你想root使用123456從任何主機連接到mysql服務(wù)器。

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

如果你想允許用戶jack從ip為10.10.50.127的主機連接到mysql服務(wù)器,并使用654321作為密碼

mysql>GRANT ALL PRIVILEGES ON *.* TO 'jack'@'10.10.50.127' IDENTIFIED BY '654321' WITH GRANT OPTION;
mysql>FLUSH RIVILEGES

c:在安裝mysql的機器上運行:

//進入MySQL服務(wù)器
d:\mysql\bin\&;mysql -h localhost -u root
//賦予任何主機訪問數(shù)據(jù)的權(quán)限
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION
//使修改生效
mysql>FLUSH PRIVILEGES
//退出MySQL服務(wù)器
mysql>EXIT

總結(jié)

到此這篇關(guān)于centos7下安裝mysql6初始化安裝密碼的方法的文章就介紹到這了,更多相關(guān)centos7下安裝mysql6初始化安裝密碼內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • mysql第一次安裝成功后初始化密碼操作步驟
  • Mac下MySQL初始化密碼操作
  • mysql8.0.12如何重置root密碼
  • mysql5.7及mysql 8.0版本修改root密碼的方法小結(jié)
  • mysql設(shè)置更改root密碼、mysql服務(wù)器的連接、mysql常用命令的圖解
  • 安裝mysql8.0.11及修改root密碼、連接navicat for mysql的思路詳解

標簽:貴州 鷹潭 鎮(zhèn)江 合肥 北京 臺灣 阜新 日照

巨人網(wǎng)絡(luò)通訊聲明:本文標題《centos7下安裝mysql6初始化安裝密碼的方法》,本文關(guān)鍵詞  centos7,下,安裝,mysql6,初始化,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《centos7下安裝mysql6初始化安裝密碼的方法》相關(guān)的同類信息!
  • 本頁收集關(guān)于centos7下安裝mysql6初始化安裝密碼的方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    班玛县| 高尔夫| 深州市| 陆丰市| 武穴市| 广安市| 榆中县| 云南省| 葵青区| 攀枝花市| 从江县| 蓬莱市| 怀来县| 凌云县| 河曲县| 来宾市| 桓仁| 杭锦旗| 惠来县| 牟定县| 博乐市| 葫芦岛市| 商河县| 临朐县| 仁化县| 连州市| 兴和县| 静乐县| 海阳市| 龙泉市| 龙游县| 兰州市| 建瓯市| 静乐县| 名山县| 西峡县| 江永县| 庆阳市| 棋牌| 栾城县| 陵川县|