MySQL环境部署
阅读目录:
http://dev.mysql.com/downloads/mysql/
可以看到上图,MySQL5.7它没有data目录,如果没有data目录,安装后启动的时候就会报这个错:
D:\\Service\\mysql57\\bin>net start mysql MySQL 服务正在启动 . MySQL 服务无法启动。 服务没有报告任何错误。 请键入 NET HELPMSG 3534 以获得更多的帮助。为了避免这个错误,需要使用命令生成data文件夹,按如下步骤安装
1. 进入dos的命令行,一定要用administrator进入。
2. 进入MySQL的bin目录,输入mysqld –install可以安装MySQL
D:\\>cd D:\\Service\\mysql57\\bin D:\\Service\\mysql57\\bin\>mysqld -install Service successfully installed.3. 输入以下命令,可以初始化MySQL数据库,初始化了之后,会打印出MySQL的默认生成的密码,下面标红了的就是默认生成的密码。
D:\\Service\\mysql57\\bin>mysqld --initialize --user=root --console 2015\-12\-20T08:13:45.264865Z 0 \[Warning\] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit\_defaults\_for\_timestamp server option (see documentation for more details). 2015\-12\-20T08:13:45.854579Z 0 \[Warning\] InnoDB: New log files created, LSN=45790 2015\-12\-20T08:13:45.998772Z 0 \[Warning\] InnoDB: Creating foreign key constraint system tables. 2015\-12\-20T08:13:46.098118Z 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: 9755c3ea-a6f1-11e5-81a3-74d02b122fb3. 2015\-12\-20T08:13:46.121617Z 0 \[Warning\] Gtid table is not ready to be used. Table 'mysql.gtid\_executed' cannot be opened. 2015\-12\-20T08:13:46.135153Z 1 \[Note\] A temporary password is generated for root@localhost: g!gRw!d%M0Sj初始化了以后,可以看到MySQL目录下,多了data目录
4. 启动MySQL服务
D:\\Service\\mysql57\\bin>net start mysql MySQL 服务正在启动 . MySQL 服务已经启动成功。5. 使用默认生成的密码,进入mysql
D:\\Service\\mysql57\\bin>mysql -u root -p Enter password: \*\*\*\*\*\*\*\*\*\*\*\* Welcome to the MySQL monitor. Commands end with ; or \\g. Your MySQL connection id is 4 Server version: 5.7.10 Copyright (c) 2000, 2015, 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\>6. 进入了mysql就可以修改默认密码了(我把默认密码修改成了root)
mysql> set password = password('root') ;这个时候,Windows下的MySQL环境就已经安装好了。
,如有侵权,请联系删除。