选择Mysql的可视化管理工具
在Mysql的安装教程中,我们完成了Mysql的安装,本节我们将介绍客服端如何连接到Mysql。
MySQL Workbench
MySQL WorkBench 是官方出品的客户端,支持 Mac、Windows、Linux。因为是官方出品,所以功能比较全。
如果你是完全形式安装Mysql的,将会自动Workbench。
界面如下:
Navicat
很强大,使用很广的工具。
唯一的确定是收费的,且对Mac支持不好。
DBeaver
Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases. Supports all popular databases: MySQL, PostgreSQL, SQLite, Oracle, DB2, SQL Server, Sybase, MS Access, Teradata, Firebird, Apache Hive, Phoenix, Presto, etc.
⚡ 免费、开源, 支持MySQL,PostgreSQL等,强烈推荐。
界面如下:
Mycli
严格来说,是一款终端工具,自带提示,对Mac、Linux支持超级好。
依赖python,如果windows下,可以通过pip安装。
# 官方地址:https://www.mycli.net/install
pip install mycli
下安装完,连接时有可能报错:
PS C:\Users\Administrator> mycli
Traceback (most recent call last):
File "E:\dev-soft\python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "E:\dev-soft\python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "E:\dev-soft\python310\Scripts\mycli.exe\__main__.py", line 7, in <module>
File "E:\dev-soft\python310\lib\site-packages\click\core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "E:\dev-soft\python310\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "E:\dev-soft\python310\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "E:\dev-soft\python310\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "E:\dev-soft\python310\lib\site-packages\mycli\main.py", line 1160, in cli
mycli = MyCli(prompt=prompt, logfile=logfile,
File "E:\dev-soft\python310\lib\site-packages\mycli\main.py", line 136, in __init__
c = self.config = read_config_files(config_files)
File "E:\dev-soft\python310\lib\site-packages\mycli\config.py", line 105, in read_config_files
_config = read_config_file(_file, list_values=list_values)
File "E:\dev-soft\python310\lib\site-packages\mycli\config.py", line 52, in read_config_file
config = ConfigObj(f, interpolation=False, encoding='utf8',
File "E:\dev-soft\python310\lib\site-packages\configobj.py", line 1229, in __init__
self._load(infile, configspec)
File "E:\dev-soft\python310\lib\site-packages\configobj.py", line 1287, in _load
content = self._handle_bom(content)
File "E:\dev-soft\python310\lib\site-packages\configobj.py", line 1437, in _handle_bom
return self._decode(infile, self.encoding)
File "E:\dev-soft\python310\lib\site-packages\configobj.py", line 1517, in _decode
infile[i] = line.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa8 in position 52: invalid start byte
解决方案:
到当前用户家目录下(windows是 C:\Users<username>
)打开 .myclirc
文件(我的在C:\Users\Administrator
)
发现,其中两行有乱码:
# ======================== 修改如下(英文输入法下):
# \R - The current time, in 24-hour military time (0-C23)
# \r - The current time, standard 12-hour time (1-C12)
保存后,重新打开即可。
PS C:\Users\Administrator> mycli -hlocalhost -uroot -p123456
MySQL
mycli 1.24.1
Home: http://mycli.net
Bug tracker: https://github.com/dbcli/mycli/issues
Thanks to the contributor - Martijn Engler
Java连接mysql
# Springboot环境
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://ip:3306/newbiecms?useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true
username: root
password: 1