mysql8.0默认端口_mysql 8.0.19 安装 及 端口修改
1.創(chuàng)建my.ini文件
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# 設(shè)置3309端口
port=3309#根據(jù)自己的需要修改端口
# 設(shè)置mysql的安裝目錄
basedir=L:\1_mysql\mysql-8.0.19-winx64 #根據(jù)自己的文件位置修改
# 設(shè)置mysql數(shù)據(jù)庫的數(shù)據(jù)的存放目錄
datadir=L:\1_mysql\mysql-8.0.19-winx64\Data #根據(jù)自己的文件位置修改
# 允許最大連接數(shù)
max_connections=200
# 允許連接失敗的次數(shù)。這是為了防止有人從該主機試圖攻擊數(shù)據(jù)庫系統(tǒng)
max_connect_errors=10
# 服務(wù)端使用的字符集默認(rèn)為UTF8
character-set-server=utf8
# 創(chuàng)建新表時將使用的默認(rèn)存儲引擎
default-storage-engine=INNODB
# 默認(rèn)使用“mysql_native_password”插件認(rèn)證
default_authentication_plugin=mysql_native_password
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
[mysql]
# 設(shè)置mysql客戶端默認(rèn)字符集
default-character-set=utf8
[client]
# 設(shè)置mysql客戶端連接服務(wù)端時默認(rèn)使用的端口
port=3309#根據(jù)自己的需要修改端口
default-character-set=utf8
2.解壓mysql-8.0.19-winx64.zip到安裝目錄;
3.將my.ini文件復(fù)制到mysql-8.0.19-winx64根目錄;
4.進(jìn)入mysql-8.0.19-winx64\bin文件夾,在此文件夾下打開Powershell窗口;
5.安裝mysql,
輸入:
mysqld --install
返回:
Service successfully installed.
6.初始化mysql,
輸入:
mysqld --initialize --console
返回:
2020-05-21T01:51:15.619733Z 0 [System] [MY-013169] [Server] L:\1_mysql\mysql-8.0.19-winx64\bin\mysqld.exe (mysqld 8.0.19) initializing of server in progress as process 328
2020-05-21T01:51:15.622433Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-05-21T01:51:30.165449Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: e-%Uh<=ga1qp
7.啟動mysql,
輸入:
net start mysql
回顯:
MySQL 服務(wù)正在啟動 ..
MySQL 服務(wù)已經(jīng)啟動成功。
8.登錄mysql,
輸入:
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.19
Copyright (c) 2000, 2020, 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.
9.修改密碼:
輸入:
ALTER user 'root'@'localhost' IDENTIFIED BY '新密碼';
回顯:
Query OK, 0 rows affected (0.34 sec)
10.查看端口號:
輸入:
show global variables like 'port';
回顯:
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3309 |
+---------------+-------+
1 row in set, 1 warning (0.01 sec)
11.其它操作
停止mysql服務(wù):net stop mysql
刪除mysql:mysqld -remove mysql
刪除服務(wù):sc delete mysql
總結(jié)
以上是生活随笔為你收集整理的mysql8.0默认端口_mysql 8.0.19 安装 及 端口修改的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Mac上mysql默认端口那件事
- 下一篇: wordpress修改mysql端口_w