windows安裝MySQL8.0.13並啟動,親測完美!
阿新 • • 發佈:2018-12-20
2、在D:\database\mysql-8.0.13-winx64新建my-default.ini檔案
[mysqld] # 設定3308埠 port=3308 # 設定mysql的安裝目錄 basedir=D:\database\mysql-8.0.13-winx64 # 設定mysql資料庫的資料的存放目錄 datadir=D:\database\mysql-8.0.13-winx64\data #tmpdir=D:\database\mysql-8.0.13-winx64\temp # 允許最大連線數 max_connections=200 # 允許連線失敗的次數。 max_connect_errors=10 # 服務端使用的字符集預設為UTF8 character-set-server=utf8 # 建立新表時將使用的預設儲存引擎 default-storage-engine=INNODB # 預設使用“mysql_native_password”外掛認證 #mysql_native_password default_authentication_plugin=mysql_native_password [mysql] # 設定mysql客戶端預設字符集 default-character-set=utf8 [client] # 設定mysql客戶端連線服務端時預設使用的埠 port=3308 default-character-set=utf8
3、已管理員方式開啟CMD視窗,初始化資料庫,這裡一定要用全路徑方式,
D:\database\mysql-8.0.13-winx64\bin>D:\database\mysql-8.0.13-winx64\bin\mysqld.exe --initialize-insecure D:\database\mysql-8.0.13-winx64\bin>D:\database\mysql-8.0.13-winx64\bin\mysqld.exe --install MySQL3308 --defaults-file=D:\database\mysql-8.0.13-winx64\my-default.ini Service successfully installed. D:\database\mysql-8.0.13-winx64\bin>net start mysql3308 MySQL3308 服務正在啟動 . MySQL3308 服務已經啟動成功。
4、初次登入資料庫並修改密碼:
D:\database\mysql-8.0.13-winx64\bin>mysql -h localhost -P 3308 -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.13 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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec)
修改密碼:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysql';
Query OK, 0 rows affected (0.10 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
授權其他電腦訪問:
mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'mysql';
Query OK, 0 rows affected (0.09 sec)
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'mysql';
Query OK, 0 rows affected (0.04 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.07 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)