mysql错误问题处理

问题1、mysql 黑窗口出现错误 无法启动此应用程序 ,计算机中丢失MSVCP120.DLL,请重新安装

因为是从虚拟机上安装的新的系统,所以dos窗口输入mysql -v的时候出现了上述的错误,之后安装MSVCP120.DLL文件即可;具体的下载地址 

https://www.microsoft.com/zh-CN/download/details.aspx?id=40784

问题2;mysql -u root -p登录的时候出现错误: MySQL出现:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)问题解决

我安装的是mysql-5.7.27-win32   window7 系统

在任务管理器中查到自己的mysql服务竟然也不存在

安装完mysqld服务之后,就存在了mysql服务

综合解决  参考https://blog.csdn.net/chen97_08/article/details/81484286

1、首先安装mysqld服务器,输入命令:mysqld --install

现在就安装好了

2、接下来就是启动服务器了,输入命令:net start mysql

3.最后直接mysql -u root -p

输入密码即可登录

如下图

 问题成功的解决。

但是后来又重新的去试试用错误的root密码登录,仍然能够登录进去,这个说明了可以解决了问题2中无法登录的问题,但是重新出了一个新的=问题:密码不起作用

问题3:密码错误导致的问题以及skip-grant-tables

mysql dos 登录的时候输入错误的密码仍然能够登录(在自己没有在mysql 的my.ini 文件中注释skip-grant-tables之前,)所以我认为 是有这句的原因,可以免密码登录操作Mysql数据库,所以自己将这个文件中的skip-grant-tables注释掉之后,出现了正确的密码和错误的密码都无法登录的情况(后来才反应过来可能是自己认为的正确的密码也是不对的,所以自己输入的两个密码都是错误的)所以就去更改了自己的mysql数据库root用户的密码。

这个自己认为正确的密码可能也是错误的,所以并不是My.ini文件出了问题,而是因为密码都不对,所以登录不了

 下面来解决问题:更改mysql 的root的密码 下面借用大佬的更改密码过程的总结https://blog.csdn.net/tiankongbubian/article/details/77119751

更改密码:

  1、找到配置文件my.ini ,然后将其打开,可以选择用NotePadd++打开

2、打开后,搜索mysqld关键字

找到后,在mysqld下面添加skip-grant-tables,保存退出。

PS:若提示不让保存时,可以将该文件剪切到桌面,更改保存后再复制到mySQL目录下

# 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.

[mysqld]
skip-grant-tables

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir = D:SoftWareMySQLmysql-5.7.11-winx64
datadir = D:SoftWareMySQLmysql-5.7.11-winx64Data
port = 3306
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

这样,是用于跳过密码问题,但是呢,这并不能彻底解决!

3、重启mysql服务

在任何路径目录下,都可以关闭/重启mysql的服务呢。(因为,之前,已经配置全局的环境变量了)

net stop mysql

net start mysql

4、进入数据库,重设置密码。

mysql -u root -p Enter

不用管password Enter

mysql> use mysql; Enter

mysql> update mysql.user set authtntication_string=password('rootroot') where user='root'; (密码自己设)

mysql> flush privileges; 刷新数据库

mysql> quit;

5、密码重设置成功,改好之后,再修改一下my.ini这个文件,把我们刚才加入的"skip-grant-tables"这行删除,保存退出再重启mysql服务就可以了。

6、重启mysql服务,并登录mysql用户,用户是root,密码是rootroot。

参考链接 https://blog.csdn.net/chen97_08/article/details/81484286https://blog.csdn.net/tiankongbubian/article/details/77119751

原文地址:https://www.cnblogs.com/isme-zjh/p/11539853.html