下载解压不说
我解压在:E:/DBFiles/mysql-5.7.15-winx64/mysql-5.7.15-winx64
添加配置文件E:/DBFiles/mysql-5.7.15-winx64/mysql-5.7.15-winx64/my.ini
####################配置文件开始###################[client]default-character-set=utf8[mysqld]port=3306basedir ="E:/DBFiles/mysql-5.7.15-winx64/mysql-5.7.15-winx64"datadir ="E:/DBFiles/mysql-5.7.15-winx64/mysql-5.7.15-winx64/data/"tmpdir ="E:/DBFiles/mysql-5.7.15-winx64/mysql-5.7.15-winx64/data/"socket ="E:/DBFiles/mysql-5.7.15-winx64/mysql-5.7.15-winx64/data/mysql.sock"log-error="E:/DBFiles/mysql-5.7.15-winx64/mysql-5.7.15-winx64/data/mysql_error.log"#skip-grant-tables=1#server_id = 2#skip-lockingmax_connections=100table_open_cache=256query_cache_size=1Mtmp_table_size=32Mthread_cache_size=8innodb_data_home_dir="E:/DBFiles/mysql-5.7.15-winx64/mysql-5.7.15-winx64/data/"innodb_flush_log_at_trx_commit =1innodb_log_buffer_size=128Minnodb_buffer_pool_size=128Minnodb_log_file_size=10Minnodb_thread_concurrency=16innodb-autoextend-increment=1000join_buffer_size = 128Msort_buffer_size = 32Mread_rnd_buffer_size = 32Mmax_allowed_packet = 32Mexplicit_defaults_for_timestamp=truesql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES####################配置文件结束################### |
在zip包中已经不含data目录,需要初始化一下:mysqld --initialize
然后进行服务注册:E:/DBFiles/mysql-5.7.15-winx64/mysql-5.7.15-winx64/bin>mysqld install MySQL --defaults-file="E:/DBFiles/mysql-5.7.15-winx64/mysql-5.7.15-winx64/my.ini"
提示安装成功
服务成功注册之后,启动MySQL服务,MySQL服务可以成功启动,可以用root用户登录的时候提示要求输入密码,此时还没有设置root密码
停止服务,在my.ini中加一个skip-grant-tables=1的配置,允许跳过密码,修改过后重启MySQL服务,root用户可以正常登录
登录之后修改密码,利用alter user root identitied by 'root'的方式修改
提示:The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
然后参考网上,用:update user set authentication_string=PASSWORD('root') where User='root';可以修改成功
通过update user set authentication_string=password('root') where user ='root'的方式修改密码,提示成功
新闻热点
疑难解答