在Mysql安装成功后,我们打开MySQL 8.0 Command Line Client发现1秒闪退,经过多方面的寻找,现将解决办法写在下面:
(1)首先,我们找到MySQL文件夹下的MySQL 8.0 Command Line Client,鼠标右击,选择更多,再点击打开文件位置。
(2)进入位置后,在文件上右击选择属性,找到目标位置。
(3)我的目标位置复制下来是:"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe" "--defaults-file=C:\Program Files\MySQL\MySQL Server 8.0\my.ini" "-uroot" "-p";但是我在这段加粗的文件路径下并没有找到my.ini文件。所以闪退的原因找到了,就是缺失该文件。下面说解决方法。
(4)方法一:先在电脑上搜索一下有没有my.ini文件,如果有,将文件复制到上面加粗的文件路径下,即可解决。
方法二:如果在电脑上没有找到my.ini文件,那就新建一个文件;将以下代码复制到记事本中,保存后在改名为my.ini。最后在复制到上面加粗的文件路径下,也可以解决。
; Example MySQL config file for medium systems.
;
; This is for a large system with memory of 1G-2G where the system runs mainly
; MySQL.
;
; MySQL programs look for option files in a set of
; locations which depend on the deployment platform.
; You can copy this option file to one of those
; locations. For information about these locations, see:
; http://dev.mysql.com/doc/mysql/en/option-files.html
;
; In this file, you can use all long options that a program supports.
; If you want to know which options a program supports, run the program
; with the "--help" option.
; The following options will be passed to all MySQL clients
[client]
;password = your_password
port = 3306
socket = /tmp/mysql.sock
; Here follows entries for some specific programs
; The MySQL server
[wampmysqld]
;skip-grant-tables
port = 3306
soc
(5)再次打开MySQL 8.0 Command Line Client,正常运行。