MariaDB Tidak Bisa Login via phpMyAdmin

Jadi, saya menginstall MariaDB Server (pengganti MySQL) di raspberry pi saya dengan perintah :

  sudo apt install mariadb-server

Problemnya adalah, ketika login melalui terminal : berhasil, sedangkan saat login dengan phpMyAdmin : gagal1)

root@pi~# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 78
Server version: 10.0.29-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> status
--------------
mysql  Ver 15.1 Distrib 10.0.29-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2

Connection id:		78
Current database:	
Current user:		root@localhost
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server:			MariaDB
Server version:		10.0.29-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8mb4
Db     characterset:	utf8mb4
Client characterset:	utf8mb4
Conn.  characterset:	utf8mb4
UNIX socket:		/var/run/mysqld/mysqld.sock
Uptime:			45 min 40 sec

Threads: 1  Questions: 1793  Slow queries: 0  Opens: 249  Flush tables: 1  Open tables: 112  Queries per second avg: 0.654
--------------

MariaDB [(none)]>

show grants menunjukkan hasil sebagaimana berikut :

MariaDB [mysql]> show grants;
+------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                      |
+------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED VIA unix_socket WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                  |
+------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

MariaDB [mysql]>

Jadi, user root hanya dapat login via unix_socket. Solusinya, buat user baru saja dengan hak akses sama dengan user root tadi. LOL

MariaDB [(none)]> create user samsul;
Query OK, 0 rows affected (0.00 sec)

Buat passwordnya juga,

MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'samsul'@'%' IDENTIFIED BY 'passwordku' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

Keluar,

MariaDB [(none)]> \q
Bye

lalu login dengan user baru tersebut.

root@pi:/usr/share/phpmyadmin# mysql -u samsul -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 78
Server version: 10.0.29-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Lihat hasil perintah show grants sekarang :

MariaDB [(none)]> show grants;
+------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for samsul@localhost                                                                                                              |
+------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'samsul'@'localhost' IDENTIFIED BY PASSWORD '*FA00FAEAD806130240147CF33C5591D78Cxxxxxx' WITH GRANT OPTION |
+------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> \q
Bye

User tersebut tidak terikat dengan unix_socket. Sekarang coba login dengan http://ip-server/phpMyAdmin, dan berhasil.


1)
muncul pesan error : Connection for controluser as defined in your configuration failed.
  • linux/MariaDB.Tidak.Bisa.Login.Via.PhpMyAdmin
  • Terakhir diubah: 9 bulan yang lalu
  • (Perubahan eksternal)