Problem Description:
After installing and initializing mysql (after setting the environment variables), I modified the installation directory of mysql and closed mysql in the service. Then I started mysql again and found that I could not log in and start the service. as follows:
Solution process:
first step:
Since the directory has been changed, the environment variables need to be reconfigured.
Then run cmd in administrator mode, switch to the bin folder in the mysql installation directory, and use the mysqld --install command.
Step two:
After running, the path of the first installation appears. When it is determined that the environment variables have been modified correctly, it is inferred that the path in the registry has not been modified, and thus the path in the registry is modified.
third step:
使用win+R命令,输入regedit打开注册表。找到mysql数据的存放位置
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
在目录中找到MYSQL文件夹,发现里面果然存有修改前的路径,随后修改为当前路径保存。
the fourth step:
再次使用mysqld --install命令,发现目录已正常,接着使用net start mysql 会出现服务已启动窗口,此时能看到进程列表里面也有mysql进程在运行,启动成功。
the fifth step:
Log in to mysql through the account and password. The login is successful and the problem is solved.
Post a reference link: https://blog.csdn.net/wolfking0608/article/details/82784297