码迷,mamicode.com
首页 > 数据库 > 详细

mysql的一些常用操作

时间:2018-07-22 17:13:03      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:常用操作   导出   database   min   variables   var   cte   ike   重启   

grant all privileges on test_db.* to test@localhost identified by ‘123456‘;
grant all on test_db.* to test@localhost identified by ‘123456‘;
grant select,insert,update,delete on *.* to test@”%” identified by ‘123456’;
给 mysql 数据库授权。
flush privileges;刷新权限
mysqldump –uroot –p123456 test_db >/tmp/test.db.sql ;MySQL 备份或导出
mysql –uroot –p123456 test_db < /tmp/test.db.sql ;MySQL 导入
mysqladmin –uroot –p123456 password newpassword ;修改 MySQL root 密码
drop database test_db ; 删除数据库
drop table test01 ; 删除表
delete from test01 ; 清空表内容
show variables like ‘%char%‘; 查看数据库字符集
修改 Mysql 字符集为 UTF-8 的方法:在/etc/my.cnf 对应如下配置段加入相应命令。
[client]字段里加入 default-character-set=utf8
[mysqld]字段里加入 character-set-server=utf8
[mysql]字段里加入 default-character-set=utf8
然后重启 MySQL 服务即可。

mysql的一些常用操作

标签:常用操作   导出   database   min   variables   var   cte   ike   重启   

原文地址:https://www.cnblogs.com/activecode/p/9350143.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!