create database test; 创建一个为test的数据库
show databases; 查看有哪些数据库
create table test; 创建一个为test的表
show tables 查看有哪些表
mysql -h 127.0.0.1 -utest -p123 本机测试
select Host,User,Password from user where User='test'; 查看关于test的3个信息
update user set Password = password('321') where User='test' && Host='localhost';更新test的本地密码
update user set Password = password('321') where User='test' && Host='%'; 更新test的远程密码
update user set Password = password('123') where User='test'; 更新test本地和远程的密码
create USER 'test'@'%' IDENTIFIED BY '123'; 创建一个远程用户test 设置密码
GRANT all on *.* to 'test'@'%'; 给用户赋予远程所有权限
GRANT all on *.* to 'test'@'localhost'; 给用户赋予本地所有权限
mysqldump -u root -p --database test>20151231test.sql 备份test库
mysql -u root -p 123 <voice.sql 输入密码即可
CREATE TABLE IF NOT EXISTS person ( number INT(11), name VARCHAR(255), birthday DATE );
创建表
INSERT INTO person VALUES(1,'qwe',19900101)
插入数据
update person set birthday='10001010' where id=1;
修改数据
flush privileges mysql 新设置用户或更改密码后需用flush privileges刷新MySQL的系统权限相关表,否则会出现拒绝访问,还有一种方法,就是重新启动mysql服务器,来使新设置生效。