Liunx下登录数据库
>mysql -u 用户名 -p
创建myblog用户,本地登录,口令是myblog
create user ‘myblog‘@‘localhost‘ identified by ‘myblog‘;
创建数据库 myblogdb 并设置字符集为utf-8
create database myblogdb default character set utf8 COLLATE utf8_general_ci;
授予myblog 用户myblogdb数据库的所有权限
grant all privileges on myblog.* to ‘myblog‘@‘localhost‘ identified by ‘myblog‘;
授权 myblog 用户远程登录权限
grant all privileges on myblog.* to ‘myblog‘@‘%‘ identified by ‘myblog‘ with grant option;
刷新权限表
flush privileges;
查看用户和登录限定的host
select user,host from msyql.user;
重启mysql服务
#service mysql restart