随笔 - 366  文章 - 0  评论 - 101  阅读 - 30万

win 安装mysql

参考

MySQL 8.0 for Windows v8.0.33 官方免费绿色正式版 64位

 

DbVisualizer Pro(跨平台数据库工具) v14.0

 

在bin目录同级下创建一个文件,命名为my.ini

D:\mysql_winx64\mysql-8.0.33-winx64\   下创建data目录

编辑my.ini文件,文件内容如下:

复制代码
[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录 ---这里输入你安装的文件路径----
basedir=D:\mysql_winx64\mysql-8.0.33-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\mysql_winx64\mysql-8.0.33-winx64\data
# 允许最大连接数
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=3306
default-character-set=utf8
复制代码

管理员身份运行cmd

C:\>D:

D:\>cd \mysql_winx64\mysql-8.0.33-winx64\bin

D:\mysql_winx64\mysql-8.0.33-winx64\bin>

安装  

mysqld --initialize --console
D:\mysql_winx64\mysql-8.0.33-winx64\bin>mysqld --initialize --console
2023-06-22T05:45:15.808308Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2023-06-22T05:45:15.808348Z 0 [System] [MY-013169] [Server] D:\mysql_winx64\mysql-8.0.33-winx64\bin\mysqld.exe (mysqld 8.0.33) initializing of server in progress as process 8608
2023-06-22T05:45:15.811684Z 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.
2023-06-22T05:45:15.862957Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-06-22T05:45:16.512572Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-06-22T05:45:18.056576Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Ijfh4xgzdw?U
D:\mysql_winx64\mysql-8.0.33-winx64\bin>mysqld --install mysql
Service successfully installed.

 启动mysql

登录

复制代码
D:\mysql_winx64\mysql-8.0.33-winx64\bin>mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.33

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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>
复制代码

修改密码  否则不能用        ALTER USER 'root'@'localhost' IDENTIFIED BY '123mysql';

复制代码
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql>
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123mysql';
Query OK, 0 rows affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql>
复制代码

 

posted on   寒星12345678999  阅读(10)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示