[root@test01 10.19.166.166 ~ ]
# mysqladmin -u root -p create testdb1
Enter password: // 此处填写MariaDB数据库的密码
[root@test01 10.19.166.166 ~ ]
# mysql
MariaDB [(none)]> show databases;
| Database |
| hellodb |
| information_schema |
| mydb |
| mysql |
| performance_schema |
| test |
| testdb |
| testdb1 |<---创建的好的库
1.2:登录MariaDB库创建
MariaDB [(none)]> create database testdb2;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> show databases;
| Database |
| hellodb |
| information_schema |
| mydb |
| mysql |
| performance_schema |
| test |
| testdb |
| testdb1 |
| testdb2 |<---创建好的库
(2)MariaDB删除数据库
2.1:使用mysqladmin删除数据库
[root@test01 10.19.166.166 ~ ]
# mysqladmin -u root -p drop testdb1
Enter password: //输入数据库密码
//执行完上面的删除命令后,会出现一个提示框,提示是否确认删除此数据库
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.
Do you really want to drop the ‘testdb1‘ database [y/N] y //删除
Database "testdb1" dropped
登录查看
MariaDB [(none)]> show databases; //确认testdb1已被删除
| Database |
| hellodb |
| information_schema |
| mydb |
| mysql |
| performance_schema |
| test |
| testdb |
| testdb2 |
2.2:登录MariaDB库删除
MariaDB [(none)]> drop database testdb2;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show databases; //确认testdb2已被删除
| Database |
| hellodb |
| information_schema |
| mydb |
| mysql |
| performance_schema |
| test |
| testdb |
(3)MariaDB选择数据库,查看选择库下面的所有表
MariaDB [(none)]> show databases; //查看所有库
| Database |
| hellodb |
| information_schema |
| mydb |
| mysql |
| performance_schema |
| test |
| testdb |
7 rows in set (0.00 sec)
MariaDB [(none)]> use mydb //选择mydb数据库
Database changed
MariaDB [mydb]> show tables; //查看mydb数据库下面所有表信息
| Tables_in_mydb |
| ssc |
| t1 |
| tb2 |
| tb4 |
| tb5 |
5 rows in set (0.00 sec)