I'm using the following command
GRANT ALL PRIVILEGES ON *.* TO 'user'@'ip'
IDENTIFIED BY 'password'
WITH GRANT OPTION;
To grant all privileges to a user. Is there a way I can make the ip a wildcard like 192.168.1.*
so that I don't need to manually add each LAN ip I want give the user access to connect from?
To GRANT ALL privileges to a user , allowing that user full control over a specific database , use the following syntax: mysql> GRANT ALL PRIVILEGES ON database_name.
In this syntax: First, specify one or more privileges after the GRANT keyword. If you grant multiple privileges, you need to separate privileges by commas. Second, specify the privilege_level that determines the level to which the privileges apply.
The GRANT statement allows you to set MySQL access permissions using the following syntax: mysql> GRANT privilege ON privilege_level TO account_name; Type the following to grant `SELECT` and `INSERT` privileges to a local user on the `strongdm` database: mysql> GRANT SELECT, INSERT ON strongdm.
You can use the SQL GRANT statement to grant SQL SELECT, UPDATE, INSERT, DELETE, and other privileges on tables or views. The WITH GRANT OPTION clause indicates that JONES can grant to other users any of the SQL privileges you granted for the ORDER_BACKLOG table.
Yes, use %
in an address.
GRANT ALL PRIVILEGES ON *.* TO 'user'@'192.168.1.%'
IDENTIFIED BY 'password'
WITH GRANT OPTION;
Or you can use less restrictive host name and allow user
to connect from everywhere.
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%'
IDENTIFIED BY 'password'
WITH GRANT OPTION;
According to your requirement,
Let's start by making a new user called "chaminda" within the MySQL shell:
CREATE USER 'chaminda'@'%' IDENTIFIED BY 'password';
The first thing to do is to provide the user with necessary permission and here I have given all permission to the particular user.
GRANT ALL PRIVILEGES ON * . * TO 'chaminda'@'%' WITH GRANT OPTION;
Reload all the privileges.
FLUSH PRIVILEGES;
Note: Here host Name = % and that means you can access this database server from any host. Giving all privileges to the user is a big risk and that's not a best practice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With