首先要安裝MySQL 數據庫才可以繼續安裝圖形工具SQLyog
第一步:下載解壓包》》
MYSQL官網地址:https://dev.mysql.com/downloads/file/?id=479669
綠色安裝 直接解壓即可。
第二步》》環境變量配置
解壓之后放入E盤,需在系統進行環境變量配置
==============================================================================
第三步》》mysql初始化配置
接下來連接和啟動數據庫操作:
3.1 創建初始化配置my.ini配置文件 存放根目錄下面 復制下面文檔(需修改路徑)
[mysqld] # 設置3306端口 port=3306 # 設置mysql的安裝目錄 basedir=E:\\mysql\\mysql-8.0.12-winx64 # 切記此處一定要用雙斜杠\\,單斜杠我這里會出錯。 # 設置mysql數據庫的數據的存放目錄 datadir=E:\\mysql\\mysql-8.0.12-winx64\\Data # 此處同上 # 允許最大連接數 max_connections=200 # 允許連接失敗的次數。這是為了防止有人從該主機試圖攻擊數據庫系統 max_connect_errors=10 # 服務端使用的字符集默認為UTF8 character-set-server=utf8 # 創建新表時將使用的默認存儲引擎 default-storage-engine=INNODB # 默認使用“mysql_native_password”插件認證 default_authentication_plugin=mysql_native_password [mysql] # 設置mysql客戶端默認字符集 default-character-set=utf8 [client] # 設置mysql客戶端連接服務端時默認使用的端口 port=3306 default-character-set=utf8
3.2 在c:\Windows\system32 找到cmd.exe 右鍵以系統管理員身份啟動該程序
指令路徑切換到bin目錄下輸入指令:
//生成臨時密碼
mysqld --initialize --console
示例:
E:\mysql\mysql-8.0.12-winx64\bin>mysqld --initialize --console 2018-09-03T03:05:19.275614Z 0 [System] [MY-013169] [Server] E:\mysql\mysql-8.0.12-winx64\bin\mysqld.exe (mysqld 8.0.12) initializing of server in progress as process 7608 2018-09-03T03:05:37.017614Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: oZig3fdGSh<E 2018-09-03T03:05:50.090414Z 0 [System] [MY-013170] [Server] E:\mysql\mysql-8.0.12-winx64\bin\mysqld.exe (mysqld 8.0.12) initializing of server has completed
oZig3fdGSh<E 為系統隨機生成的臨時密碼
3.3 安裝mysql 服務
mysqld --install
示例:
E:\mysql\mysql-8.0.12-winx64\bin>mysqld --install Service successfully installed.
3.4 啟動mysql服務
net start mysql
示例:
E:\mysql\mysql-8.0.12-winx64\bin>net start mysql MySQL 服務正在啟動 .. MySQL 服務已經啟動成功。
3.5 進入mysql 輸入以下指令之后 需要輸入臨時密碼
mysql -u root -p
示例:
E:\mysql\mysql-8.0.12-winx64\bin>mysql -u root -p Enter password: ************ Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.12 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
3.6 修改臨時密碼
修改密碼為root
alter user user() identified by "root";
示例:
mysql> alter user user() identified by "root"; Query OK,0 rows affected (0.25 sec)
修改完密碼 退出數據庫操作
mysql> exit
Bye
3.7 驗證密碼
E:\mysql\mysql-8.0.12-winx64\bin>mysql -u root -p Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 8.0.12 MySQL Community Server - GPL Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
ok mysql安裝完成了密碼也修改成功了 命令行操作麻煩,推薦使用圖形化工具SQLyog。