Tag Archives: mariadb

How to show the last queries executed on MySQL?

You can enable a general query log for that sort of diagnostic. Generally you don’t log all SELECT queries on a production server though, it’s a performance killer.
Edit your MySQL config, e.g. /etc/mysql/my.cnf – look for, or add, a line like this:

[mysqld] log = /var/log/mysql/mysql.log
Code language: JavaScript (javascript)

Restart mysql to pick up that change, now you can:

tail -f /var/log/mysql/mysql.log
Code language: JavaScript (javascript)

Hey presto, you can watch the queries as they come in.

Grant all privileges to root@localhost for mariadb or mysql on ubuntu 16.04 to use phpmyadmin

If you have ever had a problem to login to phpmyadmin with root you will need to add the rights.
login to mariadb/mysql:

mysql -uroot -p

check if user is added:

SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';
Code language: HTML, XML (xml)
MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';
Code language: HTML, XML (xml)
+----------+------+ | User | Host | +----------+------+ | librenms | % | +----------+------+

Now add the root user:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'YOUR PASSWORD' WITH GRANT OPTION;
Code language: JavaScript (javascript)

And now flush:

flush privileges;
MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';
Code language: HTML, XML (xml)
+----------+-------------+ | User | Host | +----------+-------------+ | librenms | % | | root | % | +----------+-------------+