1.去官网上下载.zip格式的文件.
2.解压到一个文件夹,这里我用D:\MySql表示
3.在D:\MySql\mysql-5.7.17-winx64下新建my.ini配置文件
黄色背景色的地方需要替换成自己内容,切记!!!
####################配置文件开始################### [client] default-character-set=utf8 [mysqld] port=3306 basedir ="D:\MySql\mysql-5.7.17-winx64/" datadir ="D:\MySql\mysql-5.7.17-winx64/data/" tmpdir ="D:\MySql\mysql-5.7.17-winx64/data/" socket ="D:\MySql\mysql-5.7.17-winx64/data/mysql.sock" log-error="D:\MySql\mysql-5.7.17-winx64/data/mysql_error.log" #server_id = 2 #skip-locking max_connections=100 table_open_cache=256 query_cache_size=1M tmp_table_size=32M thread_cache_size=8 innodb_data_home_dir="D:\MySql\mysql-5.7.5-m15-winx64/data/" innodb_flush_log_at_trx_commit =1 innodb_log_buffer_size=128M innodb_buffer_pool_size=128M innodb_log_file_size=10M innodb_thread_concurrency=16 innodb-autoextend-increment=1000 join_buffer_size = 128M sort_buffer_size = 32M read_rnd_buffer_size = 32M max_allowed_packet = 32M explicit_defaults_for_timestamp=true sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES ####################配置文件结束###################
4.在Windows的PATH环境变量下加入,黄色注意替换!!!
D:\MySql\mysql-5.7.17-winx64\bin;(注意加分号)
5.打开管理员的cmd,进入到存放文件目录的/bin中,黄色注意替换!!!
mysqld install MySQL --defaults-file="D:\MySql\mysql-5.7.17-winx64\my.ini"
6.在cmd中输入
net start mysql
哈哈哈,出现MySQL服务无法启动,服务没有报告任何错误(傻眼了吧!)
7.解决办法
mysqld --romve mysqld --install mysqld --initialize net start mysql
8.现在可以正常使用mysql了,启动/停止mysql的cmd命令如下
net start mysql net stop mysql
原文地址:http://www.cnblogs.com/HurryXin/p/6181661.html
时间: 2024-11-03 03:37:50