centos mysql 操作命令、指令合集

①创建数据库:

mysql> create database sqoop;
Query OK, 1 row affected (0.09 sec)

②显示数据库:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| metastore          |
| mysql              |
| performance_schema |
| sqoop              |
| sys                |
+--------------------+
6 rows in set (0.02 sec)

③使用sqoop这个数据库

mysql> use sqoop;
Database changed

④mysql> create table studentsqoop ('id' int(4),'name' char(40));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''id' int(4),'name' char(40))' at line 1

创这个表的时候出现了错误,解决办法:把单引号替换了问题就解决了。centos mysql 操作命令、指令合集

⑤显示数据库中的表

mysql> show tables;
+-----------------+
| Tables_in_sqoop |
+-----------------+
| studentsqoop    |
+-----------------+
1 row in set (0.02 sec)

⑥插入数据

mysql> insert into studentsqoop values (1007,'jiqiren');
Query OK, 1 row affected (0.00 sec)