首先要安裝MySQL 數據庫才能夠繼續安裝圖形工具SQLyogmysql
第一步:下載解壓包》》sql
MYSQL官網地址:https://dev.mysql.com/downloads/file/?id=479669數據庫
綠色安裝 直接解壓便可。ide
第二步》》環境變量配置工具
解壓以後放入E盤,需在系統進行環境變量配置spa
==============================================================================插件
第三步》》mysql初始化配置命令行
接下來鏈接和啓動數據庫操做:code
3.1 建立初始化配置my.ini配置文件 存放根目錄下面 複製下面文檔(需修改路徑)server
[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。