mysql学习总结(一)

系统环境 linux manjaro
1 mysql安装
pacman -S mysql
2配置
sudo mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
3启动服务
systemctl start mysqld
4 登录mysql
mysql -u root -p
5 更改root密码
alter user ‘root’@‘localhost’ IDEDTIFIED BY ‘123456’;

创建数据库
create database testbase;
查看数据库
show databases;
选择数据库
use testbase;
删除数据库
drop database testbase;

创建数据表
create table testtable defination; (p68)
查看表结构
desc testtable;
desc testtable culumns;
show columns from testtable from testbase;
show columns from testtable.testbase;
修改表结构
alter table testtable add/alter/change/modify/drop/rename (p71)
表的重命名
rename table testtable to newtable;
删除表
drop table testtable;

表的插入
insert into testtable (lolunms……) values(value……)
表的查询
select * columns from testtable where group by
order by
limit count ;
表的修改
update testtable set column=value……where
表的删除
delete from testtable where

猜你喜欢

转载自blog.csdn.net/qq_41027345/article/details/87996305