LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   mariadb mysql Compatibility issue GRANT ALL ON database.* TO 'user'; (https://www.linuxquestions.org/questions/linux-server-73/mariadb-mysql-compatibility-issue-grant-all-on-database-%2A-to-user%3B-4175568847/)

enyawix 01-30-2016 10:09 PM

mariadb mysql Compatibility issue GRANT ALL ON database.* TO 'user';
 
mysql -p
create database aleX;
Query OK, 1 row affected (0.00 sec)
create USER 'aleX'@'localhost';
Query OK, 0 rows affected (0.00 sec)
SET PASSWORD FOR 'aleX'@'localhost' = PASSWORD('7!d6b4c40cd');
Query OK, 0 rows affected (0.00 sec)
GRANT ALL ON aleX.* TO 'aleX';
ERROR 1133 (28000): Can't find any matching row in the user table

GRANT ALL ON aleX.* TO 'aleX'; worked just fine on mysql

astrogeek 01-30-2016 10:23 PM

Quote:

Originally Posted by enyawix (Post 5490556)
mysql -p
create database aleX;
Query OK, 1 row affected (0.00 sec)
create USER 'aleX'@'localhost';
Query OK, 0 rows affected (0.00 sec)
SET PASSWORD FOR 'aleX'@'localhost' = PASSWORD('7!d6b4c40cd');
Query OK, 0 rows affected (0.00 sec)
GRANT ALL ON aleX.* TO 'aleX';
ERROR 1133 (28000): Can't find any matching row in the user table

GRANT ALL ON aleX.* TO 'aleX'; worked just fine on mysql

aleX@localhost is not the same user as aleX.

GRANT ALL ON aleX.* TO 'aleX'@'localhost' should work.

This works the same on MySQL and MariaDB.

If it worked this way, exactly as you have shown, on MySQL, then there would have been a non-localhost user of the same name in the users table.

enyawix 01-30-2016 10:29 PM

Found a working syntax

GRANT ALL on aleX.* to 'aleX'@'localhost';
Query OK, 0 rows affected (0.00 sec)

I hope switching will not break CMS systems designed to run on LAMP.

astrogeek 01-30-2016 10:46 PM

Quote:

Originally Posted by enyawix (Post 5490562)
Found a working syntax

GRANT ALL on aleX.* to 'aleX'@'localhost';
Query OK, 0 rows affected (0.00 sec)

I hope switching will not break CMS systems designed to run on LAMP.

Well, as noted above, there is no difference in this between MySQL and MariaDB. So if it works with 'aleX' on one but not the other, that is only because one has a MySQL 'aleX' user and the other does not.

Remember, the MySQL/MariaDB user names have nothing to do with system users of the same name. And 'username' is not the same user as 'username@localhost'.

Good luck!


All times are GMT -5. The time now is 01:43 AM.