Huong dan cai dat phpmyadmin moi nhat 2022 (ok)
PreviousHow To Install Webmin And Secure With Nginx On Ubuntu 20.04 LTS (ok) qua hayNextCan anyone confirm that phpMyAdmin AllowNoPassword works with MySQL databases? (ook)
Last updated
Last updated
Xem tắt cả các user hiện có
MariaDB [(none)]> SELECT * FROM mysql.user;
+-----------+-------------+----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+---------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+---------+--------------+--------------------+
| Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | Delete_history_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string | password_expired | is_role | default_role | max_statement_time |
+-----------+-------------+----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+---------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+---------+--------------+--------------------+
| localhost | mariadb.sys | | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 | 0 | mysql_native_password | | Y | N | | 0.000000 |
| localhost | root | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | mysql_native_password | | N | N | | 0.000000 |
| localhost | mysql | invalid | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | mysql_native_password | invalid | N | N | | 0.000000 |
| localhost | user | | Y | Y | Y | Y | Y | Y | Y | N | N | N | Y | Y | N | Y | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 | 0 | mysql_native_password | | N | N | | 0.000000 |
| localhost | user1 | | Y | Y | Y | Y | Y | Y | Y | N | N | N | Y | Y | Y | Y | N | N | Y | N | Y | N | N | Y | Y | Y | Y | N | Y | Y | N | N | | | | | 0 | 0 | 0 | 0 | mysql_native_password | | N | N | | 0.000000 |
+-----------+-------------+----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+---------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+---------+--------------+--------------------+
5 rows in set (0.005 sec)
Cách cập nhật password 1 user (ok)
ALTER USER 'mysql'@'localhost' IDENTIFIED BY '';
Chú ý: Khi cài đặt cơ sở dữ liệu chưa cập nhập lại password của root mặc dầu chúng ta vẫn truy cập được dưới dạng sudo mysql -u root -p. Do đó chúng ta cần cập nhật lại
How to set root password to null
mysql> set password = password('');
Copy config.sample.inc.php to config.inc.php.
In most cases you will find the config file
on linux: /etc/phpmyadmin/config.inc.php
on mac: /Library/WebServer/Documents/phpmyadmin/config.inc.php
If you are trying to log in as root, you should have the following lines in your config:
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
if (!empty($dbname)) {
// other configuration options
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
// it should be placed before the following line
$i++;
}
// other configuration options
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
tested the statement:
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = true;
It did not work out for me.
Instead
$cfg['Servers'][$i]['AllowNoPassword'] = true;
worked.
Thanks!
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
tar xvf phpMyAdmin-latest-all-languages.tar.gz
Move the resulting folder to /usr/share/phpmyadmin
folder.
sudo mv phpMyAdmin-*/ /usr/share/phpmyadmin
Create directory for phpMyAdmin temp files.
sudo mkdir -p /var/lib/phpmyadmin/tmp
sudo chown -R www-data:www-data /var/lib/phpmyadmin
sudo mkdir /etc/phpmyadmin/
Create phpMyAdmin configuration file.
sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
Edit the file /usr/share/phpmyadmin/config.inc.php
and set secret passphrase:
$ sudo nano /usr/share/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = 'H2OxcGXxflSd8JwrwVlh6KW6s2rER63i';
Configure Temp directory:
$cfg['TempDir'] = '/var/lib/phpmyadmin/tmp'
Tham khao: https://computingforgeeks.com/how-to-install-latest-phpmyadmin-on-ubuntu-debian/
mysql -u root -p
CREATE USER 'username'@'localhost' IDENTIFIED WITH authentication_plugin BY 'password';
Hoac:
CREATE USER 'user'@'localhost';
Sau do phan quyen
GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on *.* TO 'user'@'localhost' WITH GRANT OPTION;
/etc/nginx/sites-enabled/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
include snippets/phpmyadmin.conf;
}
/etc/nginx/snippets/phpmyadmin.conf
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}