标签:
参考文章链接:
http://jingyan.baidu.com/article/afd8f4de9006d934e286e9fd.html
http://www.cnblogs.com/wenthink/p/MySQLInstall.html
http://www.cnblogs.com/weiwang/p/5404952.html
1.配置文档:
####################配置文件开始################### # 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. [client] default-character-set=utf8 [mysqld] port=3306 basedir ="D:\mysql-5.7.14-winx64" datadir ="D:\mysql-5.7.14-winx64/data/" tmpdir ="D:\mysql-5.7.14-winx64/data/" socket ="D:\mysql-5.7.14-winx64/data/mysql.sock" log-error="D:\mysql-5.7.14-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-5.7.14-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 #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES ####################配置文件结束###################
2. 添加环境变量
3.启动服务
net start mysql
MySQL 服务正在启动 .
MySQL 服务无法启动。
问题解决
删除data文件夹里的内容
然后输入如下命令:
4.登录Access denied for user ‘root‘@‘localhost‘ (using password: NO)问题解决
1).在mysql所在的根目录下找到my-default.ini,复制里面的全部内容,
新建一个txt文档,把内容复制进去,然后保存名字改为my.ini,注意需要把文件类型也改为ini,方法查看文件类型,然后把txt后缀改为ini,如果不懂可以上网查找。
2).my.ini配置文件,打开配置文件,找到[mysqld]一行,在下面添加skip-grant-tables后保存该文件,重新启mysql动服务。
通过cmd进如到Mysql下的bin目录下,输入mysql -u root -p就可以不用密码登录了,出现password:的时候直接回车可以进入,不会出现ERROR 1045 (28000),但很多操作都会受限制,因为我们不能grant(没有权限)。
进入mysql数据库:
mysql> use mysql;Database changed
输入update mysql.user set authentication_string=password(‘root‘) where user=‘root‘ ;
输入update mysql.user set authentication_string=password(‘root‘) where user=‘root‘ ;其中password(’‘)中为你今后的密码。
重复的原因是因为跟5.7以前的输入方式不同。
原 因是:新安装的MySQL5.7,登录时提示密码错误,安装的时候并没有更改密码,后来通过免密码登录的方式更改密码,输入update mysql.user set password=password(‘root‘) where user=‘root‘时提示ERROR 1054 (42S22): Unknown column ‘password‘ in ‘field list‘,原来是mysql数据库下已经没有password这个字段了,password字段改成了authentication_string,所 以如果按照用以前的update mysql.user set password=password(‘root‘) where user] ,就会报错。
编辑my.ini文件删掉skip-grant-tables 这一行,然后重启MySQL,否则MySQL仍能免密码登录。
标签:
原文地址:http://www.cnblogs.com/goingforward/p/5748445.html