1、登录数据库
mysql -h localhost -uroot –p
2、导出数据库
mysqldump -uroot -p db > db.sql
3、导入数据库
mysql -uroot -p db < db.sql
4、开启远程登录,局域网访问
grant all privileges on *.* to 'root'@'%' indentified by '你的密码' with grant option;
flush privileges;
5、创建用户
CREATE USER 'test'@'localhost' IDENTIFIED BY 'password'; grant all privileges on *.* to test@'localhost' identified by 'test';
6、创建表
CREATE SCHEMA testdb DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
7、赋予数据库权限
GRANT ALL ON testdb.* TO 'test'@'localhost';
8、增删改查
UPDATE 表名 SET 字段名1='a',字段名2='b' WHERE 字段名3='c';insert into 表 values('字段');