Windows系統下MySQL的安裝配置以及遇到的問題
阿新 • • 發佈:2018-12-12
1:在官網下載mysql軟體包
下載window版本的軟體包
2;配置mysqlini,其中basedir,和datadir需要按照自己的安裝路徑進行修改
[mysql] # 設定mysql客戶端預設字符集 default-character-set=utf8 [mysqld] # 設定3306埠 port = 3306 # 設定mysql的安裝目錄 basedir=D:\\soft\mysql-5.7.23-winx64 # 設定mysql資料庫的資料的存放目錄 datadir=D:\\soft\mysql-5.7.23-winx64\data # 允許最大連線數 max_connections=20 # 服務端使用的字符集預設為8位元編碼的latin1字符集 character-set-server=utf8 # 建立新表時將使用的預設儲存引擎 default-storage-engine=INNODB
3:初始化Mysql
mysqld --initialize --console
介面顯示如下所示則表示初始化成功,如果出現錯誤,就把上面配置的datadir目錄刪掉重新初始化
2018-09-29T03:38:13.585303Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-09-29T03:38:14.883984Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-09-29T03:38:15.314304Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-09-29T03:38:15.540764Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 19396f60-c399-11e8-95ca-8c16451ca49d.
2018-09-29T03:38:15.564509Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-09-29T03:38:15.602421Z 1 [Note] A temporary password is generated for [email protected]: h+YXvjpgH5*j
4:安裝mysql服務
D:\soft\mysql-5.7.23-winx64\bin>mysqld install mysql5.7.32
Service successfully installed.
如果顯示已經安裝了,就把mysql換成mysql***
5:啟動剛剛安裝的服務,注意這裡的服務名稱要和安裝的一樣,否則會報錯
D:\soft\mysql-5.7.23-winx64\bin>net start mysql5.7.32 mysql5.7.32 服務正在啟動 . mysql5.7.32 服務已經啟動成功。
6:首次登陸mysql服務,這裡的密碼是初始化的時候,console展示的密碼==>h+YXvjpgH5*j
D:\soft\mysql-5.7.23-winx64\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23
7:重新設定mysql的root使用者的密碼
mysql>
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');