With the next version of MySQL that is MySQL 8, there is a very
nice feature of creating "roles" which can be assigned
certain privileges and then these roles can be assigned to users,
thus helping us in maintaining the principle of least
privilege.
It makes our life as developers and DBAs easier as we do not have
to remember what are the specific privileges assigned to
different users. These "roles" can simply be assigned or
de-assigned from users as necessary.
The setup process is pretty easy and intuitive.
1. Create Role:
CREATE ROLE 'read', 'write', 'read_write';
Which essentially …
Mermaids have the same probability of fixing
your permission problems, but people continue believing in the
FLUSH PRIVILEGES myth.I see suggesting the usage of FLUSH
PRIVILEGES
every time someone writes a tutorial or a
solution to a problem regarding creating a new account or
providing different privileges. For example, the top post on
/r/mysql
as of the writing of these lines, “MySQL:The user specified as a definer does not
exist (error 1449)-Solutions” has multiple guilty cases of
this (Update: the user has corrected those lines
after I posted this article).
It is not my intention to bash that post, but I have seen …
[Read more]
This is a response on MySQL security: inconsistencies and Less known facts about MySQL user
grants.
As far as I know the privilege to grant PROXY privileges is also
not very well understood. I blogged about that some time ago.
In addion to the already highlighted issues with GRANT
replication and grants can very well create an unwanted
situation:
master> SHOW GRANTS FOR 'user'@'host'\G[Read more]
*************************** 1. row ***************************
Grants for user@host: GRANT USAGE ON *.* TO 'user'@'host' IDENTIFIED BY PASSWORD …
Disclaimer:
This post is for educational purposes only and no responsibility will be taken if you execute any of the commands. You mess it, you fix it!
Replacing a password for a user on MySQL can be done in at least four ways. Three ways at least.
1. set password for ‘user’@'host’=password(‘abc’);
2. grant usage on *.* to ‘user’@'host’ identified by ‘abc’;
3. update mysql.user set password=password(‘abc’) where user=’user’ and host=’host’;
mysql Wed Mar 9 14:27:17 2011 > set password for 'dc'@'%' = password('d'); Query OK, 0 rows affected (0.00 sec) mysql Wed Mar 9 14:27:39 2011 > show grants for 'dc'@'%'; +---------------------------------------------------------------------------------------------------+ | Grants for dc@% | …[Read more]
I recently granted ALTER
access in MySQL so a user
could run the ALTER TABLE
command . However after I
granted the necessary privileges, the user was still not able to
perform the tasks needed. Reproducing the issue using a test
instance, I granted a test user the required privileges and MySQL
reported no errors or warnings when the ALTER TABLE
was run:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 15 Server version: 5.1.41-log MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> grant alter,create,insert on *.* to 'test'@localhost; Query OK, 0 rows affected (0.00 sec) mysql> show warnings; Empty set (0.00 sec) mysql> show errors; Empty set (0.00 sec) mysql>
The reason I granted the addition CREATE
and
INSERT
privileges is that according to the MySQL
documentation ( …
This Thursday (February 25th, 13:00 UTC - way
earlier than usual!), Darren Cassar will present Securich - Security Plugin for MySQL.
According to Darren, the author of the plugin, Securich is an
incredibly handy and versatile tool for managing user privileges
on MySQL through the use of roles. It basically makes granting
and revoking rights a piece of cake, not to mention added
security it provides through password expiry and password
history, the customization level it permits, the fact that it
runs on any MySQL 5.0 or later and it's easily deployable on any
official MySQL binary, platform independent.
More information here: http://www.securich.com/about.html.
For MySQL University sessions, point your …
[Read more]
This Thursday (February 25th, 13:00 UTC - way
earlier than usual!), Darren Cassar will present Securich - Security Plugin for MySQL.
According to Darren, the author of the plugin, Securich is an
incredibly handy and versatile tool for managing user privileges
on MySQL through the use of roles. It basically makes granting
and revoking rights a piece of cake, not to mention added
security it provides through password expiry and password
history, the customization level it permits, the fact that it
runs on any MySQL 5.0 or later and it's easily deployable on any
official MySQL binary, platform independent.
More information here: http://www.securich.com/about.html.
For MySQL University sessions, point your …
[Read more]
This Thursday (February 25th, 13:00 UTC - way
earlier than usual!), Darren Cassar will present Securich - Security Plugin for MySQL.
According to Darren, the author of the plugin, Securich is an
incredibly handy and versatile tool for managing user privileges
on MySQL through the use of roles. It basically makes granting
and revoking rights a piece of cake, not to mention added
security it provides through password expiry and password
history, the customization level it permits, the fact that it
runs on any MySQL 5.0 or later and it's easily deployable on any
official MySQL binary, platform independent.
More information here: http://www.securich.com/about.html.
For MySQL University sessions, point your …
[Read more]
Just a small
note to advise that Securich reached 0.1.4.
Some new tools include:
* Added Password complexity
* Enhanced `set_password` – Old password is now necessary to
replace it by a new one
* Enhanced Revoke privileges to accept regexp
* Added Block user@hostname on a database level
* Added Creation of reserved usernames
* Added Help stored procedure displays help for each stored
proc
* Enhanced `create_update_role` to include the removal of
privilages from roles
* Enhanced `grant_priveleges` on `alltables` for a database
without tables would terminate with an error instead of
gracefully (now fixed)
* Added Restore user@hostname on a database level
* Removed ’show warnings’ from sql installation
The database design using workbench is also available in the db folder (for easier understanding of what lies …
[Read more]Lenz Grimmer recently wrote two blogs about password security on MySQL. Both are worth reading in detail. You’ll find them in Basic MySQL Security: Providing passwords on the command line and More on MySQL password security.
Although I wrote a comment on the latter one, there is one point I thought was worth its own blog.
GRANT … IDENTIFIED BY PASSWORD…
You can work around having to specify the password in the open following these steps:
- Use a local or non-public instance (for example using MySQL
Sandbox) to define the user / password combination you need:
CREATE USER 'name'@'host' IDENTIFIED BY 'secret';
- Use
SHOW GRANTS
to …