化妆品 网站建设案例全网
MySQL数据库安装
MySQL下载
下载地址:https://dev.mysql.com/downloads/mysql/
可以选择下载msi或zip,以下为zip模式安装步骤
下载了mysql的zip安装包之后解压即可;
Windows安装步骤
-
初始化MySQL,并记录生成的用户密码root的随机密码
在mysql安装包的bin目录下使用cmd执行以下命令
mysqld --initialize --console
E:\apply\mysql\mysql-8.0.31-winx64\bin>mysqld --initialize --console 2023-07-13T14:18:28.825887Z 0 [System] [MY-013169] [Server] E:\apply\mysql\mysql-8.0.31-winx64\bin\mysqld.exe (mysqld 8.0.31) initializing of server in progress as process 22544 2023-07-13T14:18:28.852772Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2023-07-13T14:18:29.427576Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2023-07-13T14:18:30.032669Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: .Ri0?lW#g,w0
-
安装MySQL服务
mysqld --install
E:\apply\mysql\mysql-8.0.31-winx64\bin>mysqld --install Service successfully installed.
-
启动MySQL服务
net start mysql
E:\apply\mysql\mysql-8.0.31-winx64\bin>net start mysql MySQL 服务正在启动 . MySQL 服务已经启动成功。
-
访问MySQL数据库(密码为第一步初始化mysql生成的随机密码)
mysql -u root -p
E:\apply\mysql\mysql-8.0.31-winx64\bin>mysql -u root -p Enter password: ************ Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.0.31Copyright (c) 2000, 2022, 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>
-
修改MySQL密码
alter user 'root'@'localhost' identified by '新密码';
mysql> alter user 'root'@'localhost' identified by '新密码'; Query OK, 0 rows affected (0.02 sec)
-
刷新权限使修改的密码生效
flush privileges;
mysql> flush privileges; Query OK, 0 rows affected (0.02 sec)
-
设置用户远程访问权限
RENAME USER `root`@`localhost` TO `root`@`%`;
mysql> RENAME USER `root`@`localhost` TO `root`@`%`; Query OK, 0 rows affected (0.01 sec)