linux登陆mysql数据库

mysql登录的方式是这样的:

[root@crmtestdb root]#mysql -u root -h 127.0.0.1
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.45-community MySQL Community Edition (GPL)

Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the buffer.

mysql>


 

如果有密码的话,登录方式为:

 mysql -u root -h 127.0.0.1 -p


至于该使用哪个数据库,使用哪个,应该是这样:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| wt                 |
+--------------------+
4 rows in set (0.00 sec)

mysql> use test
Database changed
mysql>

你可能感兴趣的:(数据库)