mysql5.7的windows下解壓版安裝

參考:

https://jingyan.baidu.com/article/63f236284aca280208ab3dcc.html

下載地址(清華大學鏡像站):
https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7/mysql-5.7.21-winx64.zip


1 bin下編輯my.ini,內容如下
[mysqld]
basedir=D:\mysql-5.7.21-winx64
datadir=D:\mysql-5.7.21-winx64\data
port=3306
character-set-server=utf8


[client]
port=3306
character-set=utf8


2 配置環境變量,在path中添加解壓路徑


3 啓動

以管理員身份運行cmd

輸入cd D:\mysql-5.7.21-winx64\bin進入bin目錄下
輸入mysqld --initialize --user=mysql --console

記下最後一行產生的隨機密碼


接着輸入mysqld --install
成功會顯示Servers Successfully installed
控制檯下輸入net start mysql 啓動mysql服務


4 可使用mysql -uroot -p命令來登錄數據庫,密碼爲上一步中生成的隨機密碼
使用如下語句用於更新密碼
alter user 'root'@'localhost' identified by 'root'
或者如下
update user set authentication_string = password('root'), password_expired = 'N', password_last_changed = now() where user = 'root';
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章