centos mysql 操作命令、指令合集

进入数据库

mysql -uroot -p

创建数据库:

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 操作命令、指令合集_第1张图片

显示数据库中的表

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)

查看表


mysql> select * from studentsqoop;
+------+-----------+
| id   | name      |
+------+-----------+
| 1001 | weilu     |
| 1002 | mayaxin   |
| 1003 | liuyuhang |
| 1004 | caofei    |
| 1005 | dongxu    |
| 1006 | houxinran |
+------+-----------+
6 rows in set (0.01 sec)
 

 

 

 

 

 

 

 

 

 


 

你可能感兴趣的:(笔记,大数据,mysql)