国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

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

瀏覽:2日期:2023-10-14 16:00:41

1.先停止數據庫服務器

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 = 2Mdatadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockskip-grant-tables 此處!!!!!!# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0

4.重啟數據庫

systemctl restart mysql

5.登錄數據庫

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數據庫

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

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

a、改表。

mysql -u root ?pmysql>use mysql;mysql>update user set host = ’%’ where user = ’root’;mysql>select host, user from user;

b、授權。

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

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

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

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

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

//進入MySQL服務器d:mysqlbin>mysql -h localhost -u root//賦予任何主機訪問數據的權限mysql>GRANT ALL PRIVILEGES ON *.* TO ’root’@’%’ WITH GRANT OPTION//使修改生效mysql>FLUSH PRIVILEGES//退出MySQL服務器mysql>EXIT

總結

到此這篇關于centos7下安裝mysql6初始化安裝密碼的方法的文章就介紹到這了,更多相關centos7下安裝mysql6初始化安裝密碼內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: MySQL 數據庫
相關文章:
主站蜘蛛池模板: 福鼎市| 鲁甸县| 全椒县| 阿瓦提县| 民权县| 绥江县| 定边县| 安庆市| 常山县| 平谷区| 富蕴县| 牡丹江市| 潜山县| 英超| 五寨县| 榆社县| 土默特左旗| 洞口县| 庆云县| 微山县| 房产| 黑水县| 泸西县| 安阳市| 阜城县| 西盟| 南木林县| 达尔| 南投县| 定襄县| 湘乡市| 泰州市| 扶沟县| 兴宁市| 锦州市| 淄博市| 鲜城| 鞍山市| 博罗县| 新郑市| 资中县|