1、按条件查询表中数据:
mysql> select user,host,password from user;
2、按组合条件查询表中数据:
mysql> select id, password, username, concat(first_name,' ',last_name)as full_name, email from MyTable;
3、更新表中某条数据:
mysql> update MyTable set password='pbkdf2_sha256$36000$' where id='2';
4、更新tb1表中指定的值到tb2表(相同email值的passowrd项):
UPDATE tb2,tb1
SET tb2.password=tb1.password
WHERE tb1.email=tb2.email;
5、删除某个表的某条数据:
mysql> delete from MyTable where id="2";
6、从Table2中按条件查询数据插入到Table1中:
mysql> insert into Table1 ( id, password, username, full_name, email ) select id, password, username, full_name, email from Table2;
7、导出数据库中的某个表的数据:
[root@175 bin]# mysqldump -uMyUser -pMyPassword --databases MyDatabase --tables MyTable > /usr/local/src/MyDatabase_MyTable.sql
8、导入某个表的数据到数据库:
[root@175 bin]# mysql -uMyUser -pMyPassword MyDatabase < /usr/local/src/MyDatabase_MyTable.sql
9、导出数据库:
[root@175 bin]# /usr/local/mysql/bin/mysqldump -uMyUser -p MyDatabase --default-character-set=utf8 > MyDatabase.sql
10、导入数据库:
[root@175 bin]# /usr/local/mysql/bin/mysql -uMyUser -p MyDatabase < MyDatabase.sql
11、查看数据表占用空间:
mysql> use information_schema;
mysql> select table_name, table_rows,data_length+index_length from tables where table_schema = "zabbixdb";
[THE END]