mysql 5.7.11 winx64初始密码修改

net start mysql 

从官网下载MySQL-5.7.11-winx64压缩版,安装后发现竟然有密码,尝试无果,通过修改密码搞定

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

启动成功后,登录mysql

密码为空 这里我们直接回车登录成功登录成功后,我们修改数据库执行如下

成功后刷新

关闭mysql服务在跟目录下修改文件my.ini,内容如下:注意两点
1:内容中myql的安装目录换成读者的安装目录;2最后一行代表登录是否需要密码,这里我们绕过密码登录进入mysql修改密码,所以不注释skip-grant-tables

use mysql

update user set authentication_string=password("123456") where user="root"; 
####################配置文件开始################### # For advice on how to change settings please see #  # *** 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. [client] default-character-set=utf8 [mysqld] port=3306 # D:Program Filesmysql-5.7.11-winx64mysql-5.7.11-winx64 basedir ="D:Program Filesmysql-5.7.11-winx64mysql-5.7.11-winx64/" datadir ="D:Program Filesmysql-5.7.11-winx64mysql-5.7.11-winx64/data/" tmpdir ="D:Program Filesmysql-5.7.11-winx64mysql-5.7.11-winx64/data/" socket ="D:Program Filesmysql-5.7.11-winx64mysql-5.7.11-winx64/data/mysql.sock" log-error="D:Program Filesmysql-5.7.11-winx64mysql-5.7.11-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:Program Filesmysql-5.7.11-winx64mysql-5.7.11-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" skip-grant-tables ####################配置文件结束################### 
flush privileges; 

安装成功后:

这里注意最后必需加上分号

mysql -u root -p 

致此我们密码就修改成功了,退出关闭mysql服务,然后把my.ini中最后一行注释掉,从新启动mysql服务,发现新密码生效。

修改保存后,在cmd中,由于我们已经在path配置了环境变量,所以我们可以直接启动mysql

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图