时间:2021-07-01 10:21:17 帮助过:3人阅读
登录数据库:mysql -h[IP] -u[用户名] -p[密码]
例如:登录本地数据库 mysql -hlocalhost -uroot -p123456
查看数据库:show databases;
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | | testdb | +--------------------+ 4 rows in set (0.00 sec) mysql>
创建数据库:create database [库名];
mysql> create database TestDB; Query OK, 1 row affected (0.00 sec) mysql>
切换/使用数据库:use [库名]
mysql> use testdb; Database changed
创建数据库的数据表:
create table Student ( ID varchar(50), Name varchar(50), Age int );
查看数据的数据表:show tables;
mysql> show tables; +------------------+ | Tables_in_testdb | +------------------+ | student | +------------------+ 1 row in set (0.00 sec) mysql>
MYSQL数据库的基本操作
标签:div bsp int 查看 登录 span 操作 create mysql