Posts

Showing posts from August, 2017

Moodle user keeps being redirected to user profile page after login and how to fix

One day you noticed a user keeps being redirected to the Moodle's user profile page after she successfully log in and you cannot do anything. I got that problem too and it took me a while to figure out how to fix it.

Login to Moodle using an administrator account and update all the required field of that user. Save it and everything will be ok.

It's because for some reason your user missing some required information (such as email address in my case). You will wonder how this happens because you cannot create a user if you don't input all the required information. But, there is one scenario this will happen, It's LDAP. When a user login into Moodle the first time, Moodle will create the user as long as it has username. In my case, the user has everything it needs except for the email address.

Interesting right? :D

Fix mysql ERROR 1698 (28000): Access denied for user 'root'@'localhost'

After a fresh install of MariaDB on a Ubuntu 16.04 machine, I got this error when trying to login to mysql:

$ mysql -u root -p

ERROR 1698 (28000): Access denied for user 'root'@'localhost'

Then I realized that I can login without password if I use sudo (of-course I have to enter the sudo password):

$ sudo mysql -u -p

So I's looking around on the Internet and figure out the problem. In Ubuntu 16.04, mysql is using by default the UNIX auth_socket plugin which means that db users will be authenticated by the system user credentials.

$ sudo mysql -u root

mysql> USE mysql;
mysql> SELECT User, Host, plugin FROM mysql.user;

+--------------+-------------------+
| User            | plugin                |
+--------------+-------------------+
| root             | auth_socket       |


So to login to mysql without sudo and use the password, I have to set the root (or any user) user to use the mysql_native_password plugin:

$ sudo mysql -u root

mysql> USE mysql;
mysql> UPDATE …