首先介绍mysql的安装和基本使用、进阶操作、讲解mysql的导入导出和自动备份,然后介绍安全模式修改密码和mysql的全文本搜索功能,最后记录了个人使用mysql中遇到的问题集,闲暇时我也会多看几次,巩固下基础吧。
基础使用
sudo apt-get install mysql-common mysql-server
简单使用:建库
CREATE DATABASE IF NOT EXISTS yourdbname DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
建表
create table MyClass(id int(4) not null primary key auto_increment,name char(20) not null,sex int(4) not null default '0',degree double(16,2));
增加
insert into MyClass values(1,'Tom',96.45),(2,'Joan',82.99), (2,'Wang', 96.59);
删除
delete from MyClass where id=1;
修改
update MyClass set name='Mary' where id=1;
查询
select * from MyClass;
显示所有视图
select * from information_schema.TABLES where table_type='view' AND table_schema = '数据库名';
创建用户
create user xxx identified by 'password';
重命名
rename user aaa to bbb;
删除用户
drop user aaa;
显示权限
show grants for aaa(用户);
授予权限
grant select on xxx(数据库).* to aaa(用户);
授予某个数据库的全部权限
grant all on xxx(数据库).*to aaa(用户);
grant all on xxx(数据库).* to aaa(用户)@localhost;
取消授权
revoke all on *.* from aaa(用户)@localhost;
修改权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%’ WITH