1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
Sql代码 复制代码
1. mysql -u root -pvmwaremysql>use mysql;
2. mysql>update user set host = '%' where user = 'root';
3. mysql>select host, user from user;
2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。
Sql代码 复制代码
1. GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH
GRANT OPTION;
2.FLUSH PRIVILEGES;
如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码
Sql代码 复制代码
1. GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY
2. 'mypassword' WITH GRANT OPTION;
3. FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY
'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器的dk数据库,并使用mypassword作为密码
Sql代码 复制代码
1. GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY
2. 'mypassword' WITH GRANT OPTION;
3. FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY
'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
注意授权后必须FLUSH PRIVILEGES;否则无法立即生效。
另外一种方法.
在安装mysql的机器上运行:
1、d:\mysql\bin\>mysql -h localhost -u root
//这样应该可以进入MySQL服务器
2、mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION
//赋予任何主机访问数据的权限
3、mysql>FLUSH PRIVILEGES
//修改生效
4、mysql>EXIT
//退出MySQL服务器
这样就可以在其它任何的主机上以root身份登录啦!
分享到:
相关推荐
GRANT ALL PRIVILEGES ON *.* TO joe@10.163.225.87 IDENTIFIED BY '123'; ``` 3. 赋予用户 `joe` 对本机的所有数据库的所有表的全部权限: ```sql GRANT ALL PRIVILEGES ON *.* TO joe@localhost IDENTIFIED BY '...
grant all privileges on testdb to 'dba'@'localhost'; ``` ### 4. 高级DBA权限 高级DBA需要管理整个MySQL服务器的所有数据库,权限授予如下: ```sql grant all on *.* to 'dba'@'localhost'; ``` 这将赋予`...
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123123' WITH GRANT OPTION; ``` 这样的写法会导致错误。正确的做法是分开设置权限和密码,如下所示: ```sql GRANT ALL PRIVILEGES ON *.* TO 'root'@...
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; ``` 3. **刷新权限**:更改权限后,需要执行`FLUSH PRIVILEGES;`命令,使新的权限设置立即生效。 4. **...
- `GRANT ALL PRIVILEGES ON *.* TO 'testuser'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION;` - 通过添加`WITH GRANT OPTION`子句,用户不仅拥有所有权限,还能授予其他用户权限。 - 这对于需要委派...
mysql yum install mysql mysql-server mysql-devel 完成后,用 /etc/init.d/mysqld start 启动mysql ... GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON testdb.* TO dba@'localhost'; ``` - **表级别**:授予对特定表的特定权限。 ```sql GRANT SELECT, INSERT, UPDATE, DELETE ON testdb.orders TO dba@'localhost'; ``` - **列级别**:...
转到GraphQL API样板 ...postgres= # GRANT ALL PRIVILEGES ON DATABASE go TO go; 在db.go配置数据库 // ConnectDB : connecting DB func ConnectDB () ( * DB , error ) { db , err := gorm . Open
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MyPassword' WITH GRANT OPTION; FLUSH PRIVILEGES; ``` 这里,`root`是用户名,`%`表示任何主机都可以访问(如果你想限制特定IP,可以将`%`替换为...
- `MariaDB[(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'KEYSTONE_DBPASS';` - `MariaDB[(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED...
2. 授予用户 myuser 从特定 IP 地址连接到 MySQL 服务器的权限:`GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; FLUSH PRIVILEGES;` 3. 授予用户 myuser ...
- **为root用户设置权限**:`GRANT ALL PRIVILEGES ON *.* TO root@'%' identified by 'root'; FLUSH PRIVILEGES;` #### 四、总结 以上步骤详细介绍了Ambari离线安装过程中涉及的关键知识点,包括机器节点准备、...
1.安装deb文件 ...2.修改/etc/my.cnfdatadir = /data01...create user root identified byyoupasswordmysg1>root'@'% identified by '123456' with grant option,mysq1>grant all privileges on *.* to flush privileges;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'nova'; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'...
1、离线安装 dpkg -i ./*.deb #第一安装,因依赖关系会有部分deb报错,需多次执行此命令,可安装安装完成 2、设置自启MariaDB systemctl enable mariadb.service ...> GRANT ALL PRIVILEGES ON *.* TO 'Hs
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'your-user-password' WITH GRANT OPTION; ``` 在这个命令中,`username`是你要授权的用户名,`your-user-password`是该用户的密码,`%`表示允许从...
GRANT ALL PRIVILEGES ON shandong.* TO 'demo'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; ``` 这条命令与上面的命令类似,也是为用户 `demo` 授予对 `shandong` 数据库的所有权限,并且具有授予权限的选项...
GRANT ALL PRIVILEGES ON *.* TO 'username'@'hostname' IDENTIFIED BY 'password' WITH GRANT OPTION; ``` 其中: - `GRANT ALL PRIVILEGES`表示授予所有权限。 - `ON *.*`表示对所有数据库的所有表。 - `TO ...