Rabu, 01 Juli 2020

PHPmyadmin di raspberry


Install cara ini:
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-lamp-on-debian-stretch/

JIKA ADA KENDALA...IKUTI LANGKAH SBB:

sudo apt install apache2
sudo apt install mariadb-server mariadb-client
sudo apt install php php-mysql
sudo apt install phpmyadmin

Harus disetting webserver phpmyadminnya:
PILIH apache2
BUAT phpmyadmin database =YES
HARUS KASIH password untuk phpmyadmin user DAN  strong password
JIKA DIKOSONGKAN AKAN GENERATE PASSWORD SENDIRI

UNTUK MEMAKAI phpMyAdmin GUNAKAN third user.
The root-user is not accessible to phpMyAdmin and the phpmyadmin-user doesn't have the required privileges, to administer MariaDB. 
SOLUSI:

sudo mysql

Atau kasih hak akses semua user:
sudo /usr/sbin/mysqld --skip-grant-tables

Atau update phpmyadminnya:
sudo apt update; 
sudo apt install apache2 phpmyadmin;


ATAU CARA REMOVE1 LALU INSTALL LG:
sudo apt remove mariadb-server mariadb-client phpmyadmin php --purge
sudo rm /var/www/html/phpmyadmin

CARA REMOVE2 LALU INSTALL LG:
sudo apt remove mariadb-server mariadb-client phpmyadmin php --purge
sudo apt autoremove --purge

HASILNYA SAMA ANTARA:
 /var/www/html/index.html
 /usr/share/doc/apache2/



Jika Gagal load phpmyadmin setelah install:

edit pakai nano:
nano /etc/apache2/apache2.conf

ketikkan kode sbb paling bawah:
Include /etc/phpmyadmin/apache.conf

Restart service:
sudo service apache2 restart
atau
sudo systemctl restart apache2

Jika gagal restart juga?
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/sites-enabled/001-phpmyadmin
atau
sudo dpkg-reconfigure phpmyadmin


OMG JIKA TERJADI SBB:
ERROR 1045: Access denied for user: 'root@localhost' (Using
password: NO)

atau

ERROR 1045: Access denied for user: 'root@localhost' (Using
password: YES)

+++++++++++++++++++++++++
To reset your mysqld password just follow these instructions :

Stop the mysql demon process using this command :
   sudo /etc/init.d/mysql stop

Start the mysqld demon process using the --skip-grant-tables option with this command
   sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &

Because you are not checking user privs at this point, it's safest to disable networking. In Dapper, /usr/bin/mysqld... did not work. However, mysqld --skip-grant-tables did.

+++++++++++++++++++
start the mysql client process using this command
   mysql -u root
from the mysql prompt execute this command to be able to change any password
   FLUSH PRIVILEGES;
Then reset/update your password
   SET PASSWORD FOR root@'localhost' = PASSWORD('password');
If you have a mysql root account that can connect from everywhere, you should also do:
   UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';

++++++++++++++++++
Alternate Method:
   USE mysql
   UPDATE user SET Password = PASSWORD('newpwd')   WHERE Host = 'localhost' AND User = 'root';
 
And if you have a root account that can access from everywhere:
   USE mysql
   UPDATE user SET Password = PASSWORD('newpwd')   WHERE Host = '%' AND User = 'root';
 
For either method, once have received a message indicating a successful query (one or more rows affected), flush privileges:

FLUSH PRIVILEGES;
Then stop the mysqld process and relaunch it with the classical way:

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start

When you have completed all this steps ,you can easily access to your mysql server with the password you have set in the step before.
An easy way to have a full control of your mysql server is phpmyadmin (www.phpmyadmin.net), software made in php that can give you a web interface that can be very usefull to people that havent got a lot of confidence with bash .

To install phpmyadmin on you server you will need to have 4 things:

web server apache
php
mysql server/mysql client installed
php_mysql support for apache
All packages can be found browsing synaptic.

JIKA MASIH GATOT:
sudo apt-get --purge remove mysql-server mysql-common mysql-client
sudo apt-get install mysql-server mysql-common mysql-client

In the next step be sure to chance the your-new-password with the password you want!

mysqladmin -u root password your-new-password
sudo /etc/init.d/mysql restart

mysql -u root -p
You should now be logged in as root. Make sure to notedown your password! Thanks to Illuvator for posting this method in the ubuntu forum.

The Easiest Method

sudo dpkg-reconfigure mysql-server-N.N



+++++++++++++++++

JIKA LOOP ERROR:

You have to reconfigure phpmyadmin, reset MySQL password.

Reconfigure phpmyadmin
Ctrl + Alt + T to launch terminal
sudo dpkg-reconfigure phpmyadmin
Connection method for MySQL database for phpmyadmin: unix socket
Name of the database's administrative user: root
Password of the database's administrative user: mysqlsamplepassword
MySQL username for phpmyadmin: root
MySQL database name for phpmyadmin: phpmyadmin
Web server to reconfigure automatically: apache2
ERROR 1045
ignore
sudo dpkg-reconfigure mysql-server-5.5
New password for the MySQL "root" user: mysqlsamplepassword
Repeat password for the MySQL "root" user: mysqlsamplepassword


SOLUSI:
mysql -u root -p

Entered the root password Created a new user using the following command:

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'some_very_complex_password';

Granted all permissions to newuser:

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;

CEK ULANG:
By "rootuser" you mean the MySQL root user, not the system root user, right?

During the installation of mysql-server, the MySQL root account is created and its password is stored in /etc/mysql/debian.cnf.

The configuration files of phpMyAdmin are stored in /etc/phpmyadmin.


echo "UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND plugin = 'unix_socket';FLUSH PRIVILEGES;" | mysql -u root -p


I installed MySQL using synaptic manager. Didn't have to enter a root password. The command:

mysqladmin -u root password NEWPASSWORD

Edit:
/etc/phpmyadmin/config.inc.php
Not:
/usr/share/phpmyadmin/config.inc.php

echo "UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND plugin = 'unix_socket';
FLUSH PRIVILEGES;" | mysql -u root -p



https://www.raspberrypi.org/forums/viewtopic.php?t=216346
https://help.ubuntu.com/community/MysqlPasswordReset
https://askubuntu.com/questions/34409/unable-to-login-to-phpmyadmin-with-the-root-user

Tidak ada komentar:

Posting Komentar