MySQL mysql-5.7.14-win32 压缩包(免安装版) 配置步骤
==MySQL mysql-5.7.14-win32 压缩包(免安装版) 配置步骤==
1. 自MySQL官网上下载zip版文件。文件名称为:mysql-5.7.14-win32.zip
2. 解压缩zip文件,测试路径为 D:\Coding\mysql-5.7.14-win32
3. 将解压缩路径下的bin路径添加到环境变量中:
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PATH = D:\Coding\mysql-5.7.14-win32\bin;;D:\Coding\Oracle\instantclient_12_1\bin;%JAVA_HOME%\bin;%ORACLE_HOME%;C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;D:\Program Files\Git\cmd;D:\Program Files\Microsoft SQL Server\100\Tools\Binn\;D:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Sybase\DLL;C:\Sybase\BIN;C:\Program Files\Sybase\Sybase Central\win32;C:\Sybase\ASEP
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4. 运行命令提示符(cmd.exe, Windows 7 以管理员身份运行,以便执行时获取相应的权限)
5. 将命令提示符的路径更改到 D:\Coding\mysql-5.7.14-win32\bin 目录下
6. 执行命令 mysqld --initialize ,进行初始化操作,在 D:\Coding\mysql-5.7.14-win32 下会自动生成生成 data文件夹,和 root 用户的临时登录密码( 该指令为 5.7 版本后新增的,目的是增强MySQL的安全性),位于 LingeringNight.err (LingeringNight 为当前计算机名称)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2016-08-29T02:09:38.094246Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-08-29T02:09:38.094246Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2016-08-29T02:09:38.094246Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set. 2016-08-29T02:09:39.685449Z 0 [Warning] InnoDB: New log files created, LSN=45790 2016-08-29T02:09:40.091050Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2016-08-29T02:09:40.293850Z 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: a4bbd45e-6d8d-11e6-95ab-4437e64201fa. 2016-08-29T02:09:40.340650Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. ---------------------------------------------------A temporary password--------------------------------------------------------------------------- 2016-08-29T02:09:40.340650Z 1 [Note] A temporary password is generated for root@localhost: saajELGy!0oZ ---------------------------------------------------A temporary password--------------------------------------------------------------------------- 2016-08-29T02:10:37.169950Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-08-29T02:10:37.169950Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2016-08-29T02:10:37.169950Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set. 2016-08-29T02:10:37.169950Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path. 2016-08-29T02:10:37.185550Z 0 [Note] D:\Coding\mysql-5.7.14-win32\bin\mysqld (mysqld 5.7.14) starting as process 2988 ... 2016-08-29T02:10:37.216750Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 2016-08-29T02:10:37.216750Z 0 [Note] InnoDB: Uses event mutexes 2016-08-29T02:10:37.216750Z 0 [Note] InnoDB: Memory barrier is not used 2016-08-29T02:10:37.216750Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 2016-08-29T02:10:37.216750Z 0 [Note] InnoDB: Number of pools: 1 2016-08-29T02:10:37.216750Z 0 [Note] InnoDB: Not using CPU crc32 instructions 2016-08-29T02:10:37.232350Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2016-08-29T02:10:37.247950Z 0 [Note] InnoDB: Completed initialization of buffer pool 2016-08-29T02:10:37.325950Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 2016-08-29T02:10:37.559951Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2016-08-29T02:10:37.575551Z 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2016-08-29T02:10:37.715951Z 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB. 2016-08-29T02:10:37.715951Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2016-08-29T02:10:37.715951Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2016-08-29T02:10:37.715951Z 0 [Note] InnoDB: Waiting for purge to start 2016-08-29T02:10:37.778351Z 0 [Note] InnoDB: 5.7.14 started; log sequence number 2525799 2016-08-29T02:10:37.778351Z 0 [Note] Plugin 'FEDERATED' is disabled. 2016-08-29T02:10:37.793951Z 0 [Note] InnoDB: Loading buffer pool(s) from D:\Coding\mysql-5.7.14-win32\data\ib_buffer_pool 2016-08-29T02:10:37.871951Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key 2016-08-29T02:10:37.871951Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 2016-08-29T02:10:37.871951Z 0 [Note] IPv6 is available. 2016-08-29T02:10:37.871951Z 0 [Note] - '::' resolves to '::'; 2016-08-29T02:10:37.871951Z 0 [Note] Server socket created on IP: '::'. 2016-08-29T02:10:38.137152Z 0 [Note] Event Scheduler: Loaded 0 events 2016-08-29T02:10:38.137152Z 0 [Note] D:\Coding\mysql-5.7.14-win32\bin\mysqld: ready for connections. Version: '5.7.14' socket: '' port: 3306 MySQL Community Server (GPL) 2016-08-29T02:10:38.495953Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160829 10:10:38 2016-08-29T02:13:33.395060Z 2 [Note] Aborted connection 2 to db: 'mysql' user: 'root' host: 'localhost' (Got an error reading communication packets)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7. 复制 my-default.ini ,并更改名称为my.ini, 添加basedir 和datadir,以及 编码格式:
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/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] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. # basedir = D:\Coding\mysql-5.7.14-win32 # datadir = D:\Coding\mysql-5.7.14-win32\data # port = ..... # server_id = ..... # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES # server encoding character-set-server = utf8 [client] default-character-set = utf8
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
8. 执行命令 mysqld --install MySQL --defaults-file="D:\Coding\mysql-5.7.14-win32\my.ini",将MySQL 添加到服务中,
9.执行 net start MySQL ,启动MySQL服务
至此,MySQL 配置成功
==修改管理员用户root 临时密码==
2.1 以管理员身份运行cmd.exe ,并 执行 mysql -u root -p
2.2 输入临时密码
2.3 登录成功后,输入 mysql> set password for root@localhost = password('new password') 更改临时密码。
mysql> set password for root@localhost = password('new password')
== END ==
上一篇: workerman的基本用法(示例详解)