查看mysql数据库
发布网友
发布时间:2022-04-25 13:01
我来回答
共5个回答
热心网友
时间:2022-05-01 23:41
我也被这个问题困扰了,刚才看了flweb的回答得到启发。感谢flweb!
进入命令行即cmd中,进入到安装了mySql的路径下,我的是
C:\Program Files\MySQL\MySQL Server 5.1\bin>
C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N
O)
直接输入mysql得到错误提示,拒绝访问。因为没有输入密码。由此可以知道默认的用户是ODBC。
C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqlshow
mysqlshow: Access denied for user 'ODBC'@'localhost' (using password: NO)
直接输入mysqlshow得到错误提示,拒绝访问。因为没有输入密码。
C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqlshow -u root -p 123456
Enter password: ******
mysqlshow: Unknown database '123456'
mysqlshow的意思是显示该用户下的数据库,-u 后跟用户,-p表示要输入密码,但其后如果
有东西那么表示的是数据库的名称而不是叫我们输入密码,密码输入执行这条指令后会提示
输入密码。
C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqlshow -u root -p
Enter password: ******
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
上面就达到了我们的目的。
C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqlshow -u root -p test
Enter password: ******
Database: test
+--------+
| Tables |
+--------+
+--------+
这条指令的功能是显示test的数据库的内容。
执行下面这条指令后就可以开始我们的mysql之旅了。
C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 24
Server version: 5.1.50-community MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> \h 显示帮助
For information about MySQL procts and services, visit:
http://www.mysql.com/
For developer information, including the MySQL Reference Manual, visit:
http://dev.mysql.com/
To buy MySQL Enterprise support, training, or other procts, visit:
https://shop.mysql.com/
List of all MySQL commands:
Note that all text commands must be first on line and end with ';'
? (\?) Synonym for `help'.
clear (\c) Clear the current input statement.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
help (\h) Display this help.
notee (\t) Don't write into outfile.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
quit (\q) Quit mysql.
rehash (\#) Rebuild completion hash.
source (\.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing binlog
with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.
For server side help, type 'help contents'
mysql> \q 退出mysql
Bye
热心网友
时间:2022-05-02 00:59
你没有要求登录
命令:mysql -uXXX(XXX表示你要登录的用户名) -pXXX(XXX表示登录的密码也可以是空,回车后会要求你录入的)
如:mysql -uroot -p123
表示:用root用户名(密码123)登录localhost(本地服务器)
热心网友
时间:2022-05-02 02:34
密码错了
热心网友
时间:2022-05-02 04:25
你登陆时是不是输入:
mysql -uroot;
如果是这样就错了
应该这样输入
mysql -uroot
热心网友
时间:2022-05-02 06:33
密码错误被。好好看看