1,下载mysql5.7压缩文件【具体到官网下载就行了】
2,解压并把mysql5.7放到c盘根目录下
3,进入mysql5.7主目录修改my-default.ini 重命名为:my.ini [如果没有的话就自己创建一个my.ini]
4,my.ini配置:
[client] port=3306 default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld] basedir="C:\mysql57" datadir="C:\mysql57\data" explicit_defaults_for_timestamp=true port=3306 server_id=1 character-set-server=utf8 default-storage-engine=INNODB sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" log-output=FILE general-log=0 general_log_file="123-PC.log" slow-query-log=1 slow_query_log_file="123-PC-slow.log" long_query_time=10 max_connections=151 query_cache_size=0 table_open_cache=2000 tmp_table_size=25M thread_cache_size=10 myisam_max_sort_file_size=100G myisam_sort_buffer_size=42M key_buffer_size=8M read_buffer_size=64K read_rnd_buffer_size=256K sort_buffer_size=256K innodb_flush_log_at_trx_commit=1 innodb_log_buffer_size=1M innodb_buffer_pool_size=8M innodb_log_file_size=48M innodb_thread_concurrency=9 innodb_autoextend_increment=64 innodb_buffer_pool_instances=8 innodb_concurrency_tickets=5000 innodb_old_blocks_time=1000 innodb_open_files=300 innodb_stats_on_metadata=0 innodb_file_per_table=1 innodb_checksum_algorithm=0 back_log=80 flush_time=0 join_buffer_size=256K max_allowed_packet=4M max_connect_errors=100 open_files_limit=4161 query_cache_type=0 sort_buffer_size=256K table_definition_cache=1400 binlog_row_event_max_size=8K sync_master_info=10000 sync_relay_log=10000 sync_relay_log_info=10000 [WinMySQLadmin] Server=C:\mysql57\bin\mysqld.exe
【注意:】
以上配置主要有几点需要改,如下:
Server=C:\mysql57\bin\mysqld.exe
basedir="C:\mysql57"
datadir="C:\mysql57\data"
explicit_defaults_for_timestamp=true
5,注册mysql服务
使用管理员身份打开cmd,进入mysql目录下的bin
1)注册服务:
mysqld install
2)初始化配置
mysqld --initialize-insecure
3)开启服务
net start mysql
4)设置root用户密码:
mysqladmin -u root -p password【注意第一步不输入密码,直接enter,第二步会提示你输入新密码以及验证密码】
5)mysql -u root -p【输入密码开启你的mysql之旅吧】
忘了,还有一件事,配置一下mysql\bin下的环境变量【总不能每次都进mysql的bin目录执行吧】
祝你安装顺利!!