GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
就有了两个root用户,mysql -u root -p(是host为localhost的root用户) 登录后
进入mysql数据库:use mysql;(无论哪个用户登录,都共享mysql数据库)
select host,user from user;
删除其中一个root :delete from user where user=‘root’ and host=‘localhost’
现在只有一个root,他的host是‘%’
2 root 登录不上,用它登录
mysql -u debian-sys-maint -p(mysql.sys也行?试了不行,why?)(还有root用户三个默认用户)
密码在:/etc/mysql/debian.cnf(据说重启一次换一次密码)
进去use mysql;修改roo密码,set password for 'root'@'localhost' = password('yourpass');(host是‘%’就把localhost换成相应的)
登录之后information_schema和performance_schema和mysql和sys是上面是上面三个用户共有的数据库,自己的newsky用户新建了ssid,他们也都有。
3
修改root账户登录密码: mysql> update user set password=password('') where user='root'; ERROR 1054 (42S22): Unknown column 'password' in 'field list' ---报错没有password这个数据字段列 描述user表 mysql> desc user; 修改密码 mysql> update user set authentication_string=password('123abc') where user='root';
