如何以其他用户身份登录MySQL? [英] How to log in into MySQL as a different user?

查看:225
本文介绍了如何以其他用户身份登录MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我吗?我很想知道如何在MySql中更改用户.也就是说,除了默认用户root之外,我还创建了另一个用户,但是我想登录到我创建的用户帐户,而不是自动登录到root.反正我能做到吗?我已经尝试使用MySql Console,但它无法正常工作,也许我没有正确的语句来做到这一点.谢谢

Could anyone help me please? I wolud like to know how to change user in MySql. That is, I created another user besides the default user root but i want to be logged in to the user account i created instead of being logged in to root automatically. Is there anyway I can do that? I've tried using MySql Console but its not working, maybe I don't have the right statements to do that. thanks

推荐答案

在命令提示符下

mysql -h主机-u用户名-p

mysql -h host -u username -p

表格 mysql文档:

shell> mysql --user =用户名--password =您的密码db_name

shell> mysql --user=user_name --password=your_password db_name

然后键入一个SQL语句,以;",\ g或\ G结尾,然后按Enter.

Then type an SQL statement, end it with ";", \g, or \G and press Enter.

这篇关于如何以其他用户身份登录MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆