-
给数据库添加管理员用户
grant all on caiyi.* to ‘cyUser’@’localhost’ identified by ’123456′ with grant option;
要用已有帐号访问caiyi外的数据库,将你在Grant 语句中的caiyi替换你想要访问的数据库名就行了,要用一个已有的账号访问caiyi数据库,用那个账号替换‘cyUser’@’localhost’ 的cyUser即可,然而,在该情况下,要略去语句中的identified by ’123456′部分,否则你就会该改变已有账号的密码
-
给数据库添加web用户
grant select,update,insert,delete on books.* to ‘cyUser’@’localhost’ identified by ’123456′;
-
执行数据文件
mysql -uroot -p111111 -P 3306 -S mysql.sock -e ‘source’
mysql -uroot -p111111 -P 3306 -S mysql.sock -e “load data infile ‘/tmp/sql.sql’ into table tablename terminated by ‘\t'”
mysql -uroot -p111111 -P 3306 -S mysql.sock dbname < sql.sql
转载请注明:cooljun小窝 » 数据库常用命令
如果你觉得这篇文章对你有帮助,请支持我继续更新网站 !
捐赠本站