二、登录及一些基本操作
本章的主要目的是让我们对MYSQL的基础框架有个大概的了解。
1 连接与断开MYSQL服务器
安装完毕登陆MYSQL(有过一些其他数据库基础的人都应该很容易使用这几步):
我们可以利用如下参数查看MYSQL命令的帮助:
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql –help
联接MYSQL服务器:
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -h localhost -uroot -p888888
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 22 to server version: 5.0.27-community-nt
![]()
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
![]()
mysql> SHOW DATABASES;
![]()
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| root |
+--------------------+
3 rows in set (0.08 sec)
mysql> SELECT DATABASE();
+------------+
| database() |
+------------+
| NULL |
+------------+
1 row in set (0.78 sec)
![]()
mysql> QUIT
Bye
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql --user=root -p mysql
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 5.0.27-community-nt
![]()
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
![]()
mysql> select database();
+------------+
| database() |
+------------+
| mysql |
+------------+
1 row in set (0.00 sec)
![]()