//Mysql版本:5.7.13
1.以管理员身份运行命令提示符,转到mysql的安装位置 2.启动mysql服务:net start mysql 3.root身份登录:mysql -uroot -p 回车键
4.列出所有数据库:show databases; 5.创建一个数据库:create databases Database_Name; 6.判断是否存在再创建数据库:create databases if not exists Database_Name; 7.删除数据库:drop database Database_Name; 8.选择一个数据库:use Database_Name;
9.列出选中数据库中的所有数据表:show tables; 10.展示数据表的列(column)详情:show columns from Table_Name;或者:describe Table_Name; 11.选中展示数据表:select * from Table_Name; 12.带条件展示数据表:select * from Table_Name where id>=2; 13.创建数据表:create table Table_Name(col_01_Name Type Details,col_02_Name Type Details,...); 14.先判断再创建数据表:create table if not exists Table_Name(...); 15.复制数据表:create table Table_Name_01 select * from Table_Name_02; 16.重命名数据表:alter table Table_Name rename as New_Table_Name;或者:rename table Old_Name to New_Name; 17.删除数据表:drop table Table_Name;
18.向数据表添加纪录:insert into Table_Name set col_01=Value1,col_02=Value2; 19.修改数据表中的记录:update Table_Name set col_Name=New_Value where id=1; 20.删除数据表中的记录:delete from Table_Name; 21.带条件删除数据表中的记录:delete from Table_Name where id=1;
22.#当前时间查看:select now(); 23.#当前用户:select user(); 24.#当前数据库程序版本:select version(); 25.#当前状态:show status; 26.#查看当前连接的用户:show processlist;