Chinaunix首页 | 论坛 | 博客
  • 博客访问: 150524
  • 博文数量: 49
  • 博客积分: 45
  • 博客等级: 民兵
  • 技术积分: 545
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-23 13:22
文章分类
文章存档

2017年(5)

2016年(18)

2015年(18)

2014年(8)

我的朋友

分类: Mysql/postgreSQL

2016-12-24 11:13:01

(也许有很多人跟我遇过到同样的问题)
======================================================================================
首先,我是照着这个链接安装的:
http://blog.csdn.net/rebirth_love/article/details/53608483
数据库可以安装成功,但是服务不能启动。
其中评论区有提到,要在第四步执行mysqld --initialize --user=mysql --console 初始化

但是按照他这样做还是不成功,我是装在D盘,D:\mysql-5.7.17-winx64\


首先,如果你不是在D:\mysql-5.7.17-winx64\bin

比如你在cmd 默认目录下执行mysqld --initialize --user=mysql --console ,则会提示: [ERROR] Can't find error-message file 'C:\WINDOWS\system32\%MYSQL_HOME%\share\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.

所以是目录不对,要切到D:\mysql-5.7.17-winx64\bin 目录,但是还是提示: [ERROR] Can't find error-message file 'D:\mysql-5.7.17-winx64\bin\%MYSQL_HOME%\share\%MYSQL_HOME% hare\english\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.

明显目录不对,于是我就把参考链接中的配置脚本上,关于配置目录的全部注释掉,OK ,默认目录都是对的了。成功!
附上操作图片和最后的my.ini 配置脚本。

#########################################################
    [client]
    port=3306
    default-character-set=utf8
    [mysqld]
    #basedir=%MYSQL_HOME%
    #解压目录
    #language=%MYSQL_HOME%\share\english
    port=3306
    character_set_server=utf8
    #datadir=%MYSQL_HOME%\data
    #解压目录下data目录
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    [WinMySQLAdmin]
    %MYSQL_HOME%\bin\mysqld.exe
########

==========================分界线=============================================================================================

刚安装好后,按道理是没有root密码的,但是我这就是有密码,而且我还不知道密码,显示如下:

D:\>mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

D:\>mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

处理方法是在my.ini 文件里[mysqld]下面添加一句:skip-grant-tables                    顾名思义,启动的时候 跳跃权限表的限制,不用验证密码,直接登录。
net stop MySQL 关闭数据库服务,然后net start MySQL 打开,

这个时候在登录就不需要密码了,显示如下:
D:\>mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

现在是免密码登录了,修改密码方法待续
============================================================


阅读(3583) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~