在Ubuntu 12.0.4 LTS上通过apt-get安装Mysql之后,我将其置于无权限的位置,可以执行任何操作来授予权限或创build新用户。
我只能通过它连接到它
mysql –defaults-file = / etc / mysql / debian.cnf
select host,user ,select_priv, Create_user_priv from mysql.user;
返回下表:
+-----------+------------------+-------------+------------------+ | host | user | select_priv | Create_user_priv | +-----------+------------------+-------------+------------------+ | localhost | apsc | N | N | | localhost | pma_GSn1wBscFLp0 | N | N | | localhost | pp_sb_db | N | N | | localhost | debian-sys-maint | Y | Y | | localhost | admin | N | N | | localhost | pma_FoXErUK90AbF | N | N | +-----------+------------------+-------------+------------------+
我如何创build一个拥有所有权限的root用户? 完全重置将是我的罚款。
像下面的命令只返回access denied错误
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION
在你的MySQL数据库中似乎没有root用户。 debian-sys-maint用户是等同的根。 以下是如何添加一个root用户:
mysql -u debian-sys-maint -p
当提示input密码时,在数据库中input位于/etc/mysql/debian.cnf的密码,您应该可以运行:
grant all privileges on *.* to 'root'@'localhost' identified by 'yourpassword' with grant option