个人环境:window十、MySQL5.7html
在cmd中输入下面的内容:mysql
host(服务器地址)、user(用户名)、-p(须要输入密码)sql
mysql -h host -u user -p
结果以下:数据库
如过你登录的是本机上的数据库,能够省略host:服务器
mysql -u user -p
结果以下:ui
某些安装或者设置的mysql容许用户匿名登录,你能够直接输入mysql登入:this
Some MySQL installations permit users to connect as the anonymous (unnamed) user to the server running on the local host. If this is the case on your machine, you should be able to connect to that server by invoking mysql without any options:code
mysql
结果以下(我电脑上的设置反正是不容许的):server
退出mysql服务器:htm
quit
exit
Ctrl + Z(Enter)
听说,Unix上能够使用Ctrl+D退出链接。
参考: