在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
以root登录系统 顺带记录一下在MySQL配置过程中可能会用到的重要东西: shell> mysql --user=root mysql
mysql> INSERT INTO user (Host,User,Password) VALUES('localhost','custom',PASSWORD('stupid')); mysql> INSERT INTO user (Host,User,Password) VALUES('server.domain','custom',PASSWORD('stupid')); mysql> INSERT INTO user (Host,User,Password) VALUES('whitehouse.gov','custom',PASSWORD('stupid'));
(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv, Create_priv,Drop_priv) VALUES ('localhost','bankaccount','custom','Y','Y','Y','Y','Y','Y');
mysql> INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv, Create_priv,Drop_priv) VALUES ('whitehouse.gov','expenses','custom','Y','Y','Y','Y','Y','Y');
mysql> INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv, Create_priv,Drop_priv) VALUES('%','customer','custom','Y','Y','Y','Y','Y','Y');
mysql> FLUSH PRIVILEGES;
(1)mysql>GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'something' WITH GRANT OPTION; mysql>GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'something' WITH GRANT OPTION; 第一句增加了一个root用户授权通过本地机(localhost)访问,密码“something”。 第二句则是使用通配符,授与root用户从任何其它主机发起的访问。 (2)亦可直接使用update语句修改user表:使用root用户或其他用户登录mysql,转到mysql数据库 update user set host='localhost' where user='root'; flush privileges;//只允许root在本机登录 update user set host='%' where user='root'; flush privileges;//允许root远程访问
|
请发表评论