安装MySQL8.0.26后,MySQL WorkBench出现“Exception: Current profile has no WMI enabled”错误
经过阅读log中给出的出错提示:
20:18:21 [ERR][wb_server_management.py:local_run_cmd_windows:407]: Exception executing local command: chcp.com: 'utf-8' codec can't decode byte 0xbb in position 0: invalid start byte
Traceback (most recent call last):
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\wb_server_management.py", line 404, in local_run_cmd_windows
retcode = OSUtils.exec_command(command, output_handler)
File "C:\Program Files\MySQL\MySQL Workbench 8.0\workbench\os_utils.py", line 360, in exec_command
for line in iter(process.stdout.readline, ""):
File "C:\Program Files\MySQL\MySQL Workbench 8.0\Python\Lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 0: invalid start byte
分别打开这三个出错源代码文件,然后根据最后的一句提示,终于发现了出错源头,在os_utils.py源文件中
process = subprocess.Popen(command, stdin = subprocess.PIPE, encoding="utf-8", stdout = subprocess.PIPE, stderr = subprocess.STDOUT, shell=True)
# Sends all the command output to the listener
if output_handler:
for line in iter(process.stdout.readline, ""):
encoding参数是“utf-8”,这就是罪魁祸首。。。。。
解决方案一
直接切换操作系统的语言为英文,重启电脑后,经过验证完美解决
解决方案二
修改上面提到的os_utils.py的源代码,将utf-8改成gbk,然后重启MySQL workbench,经验证也完美解决
参考文献: