Basically means that: db_users using it, will be “auth” by the system user credentias. You can see if your root user is set up like this by doing the following:

sudo mysql -u root # I had to use "sudo" since is new installation

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

+------------------+-----------------------+
| User             | plugin                |
+------------------+-----------------------+
| root             | auth_socket           |
| mysql.sys        | mysql_native_password |
| debian-sys-maint | mysql_native_password |
+------------------+-----------------------+

As you can see in the query, the root user is using the auth_socket plugin

There are 2 ways to solve this:

  1. You can set the root user to use the mysql_native_password plugin
  2. You can create a new db_user with you system_user (recommended)

Option 1:

sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart

Some systems like Ubuntu, mysql is using by default the UNIX auth_socket plugin.

Basically means that: db_users using it, will be “auth” by the system user credentias. You can see if your root user is set up like this by doing the following:

$ sudo mysql -u root # I had to use "sudo" since is new installation

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

+------------------+-----------------------+
| User             | plugin                |
+------------------+-----------------------+
| root             | auth_socket           |
| mysql.sys        | mysql_native_password |
| debian-sys-maint | mysql_native_password |
+------------------+-----------------------+

As you can see in the query, the root user is using the auth_socket plugin

There are 2 ways to solve this:

  1. You can set the root user to use the mysql_native_password plugin
  2. You can create a new db_user with you system_user (recommended)

Option 1:

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart

Option 2: (replace YOUR_SYSTEM_USER with the username you have)

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> CREATE USER 'YOUR_SYSTEM_USER'@'localhost' IDENTIFIED BY '';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'YOUR_SYSTEM_USER'@'localhost';
mysql> UPDATE user SET plugin='auth_socket' WHERE User='YOUR_SYSTEM_USER';
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart

Remember that if you use option #2 you’ll have to connect to mysql as your system username (mysql -u YOUR_SYSTEM_USER)

Note: On some systems (e.g., Debian stretch) ‘auth_socket’ plugin is called ‘unix_socket’, so the corresponding SQL command should be: UPDATE user SET plugin='unix_socket' WHERE User='YOUR_SYSTEM_USER';

Update: from @andy’s comment seems that mysql 8.x.x updated/replaced the auth_socket for caching_sha2_password I don’t have a system setup with mysql 8.x.x to test this, however the steps above should help you to understand the issue. Here’s the reply:

mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld

Stop the MySQL service

sudo /etc/init.d/mysql stop

Start MySQL without a password

sudo mysqld_safe –skip-grant-tables &

Connect to MySQL

mysql -uroot

Set a new MySQL root password

use mysql;
update user set authentication_string=PASSWORD("newpassword") where User='root';
flush privileges;
quit

Stop and start the MySQL service

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

Log in to the database

mysql -u root -p

Warning

mysqld_safe Directory ‘/var/run/mysqld’ for UNIX socket file don’t exists

mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld

Method 2

sudo service mysql start
cd /var/run
sudo cp -rp ./mysqld ./mysqld.bak
sudo service mysql stop
sudo mv ./mysqld.bak ./mysqld
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
FLUSH PRIVILEGES;

SET PASSWORD FOR root@'localhost' = PASSWORD('my_new_password');

Edit this file

/opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf

Change ServerName and ServerAlias to your domain,
then Add these lines

RewriteCond %{HTTP_HOST} ^yourwebsite.com 
RewriteRule (.*) https://www.yourwebsite.com/$1 [R=301,L]

Then restart apache

sudo /opt/bitnami/ctlscript.sh restart apache

Permission issues with WordPress

sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs/wp-content/cache
sudo find /opt/bitnami/apps/wordpress/htdocs/wp-content/cache -type f -exec chmod 664 {} \;
sudo find /opt/bitnami/apps/wordpress/htdocs/wp-content/cache -type d -exec chmod 775 {} \;
sudo chown bitnami:daemon /opt/bitnami/apps/wordpress/htdocs/wp-config.php
sudo chmod g+w /opt/bitnami/apps/wordpress/htdocs/wp-config.php
sudo chown bitnami:daemon /opt/bitnami/apps/wordpress/htdocs/.htaccess
sudo chmod g+w /opt/bitnami/apps/wordpress/htdocs/.htaccess

Sometimes you need to get your virtual host file, you can get them by :

a2query -s

or

apachectl -S

 

To connect to MySQL

mysql -u root -p

Create a MysSQL Datatase

CREATE DATABASE mydatabase;

or Create a MySQL database character with charset UTF-8

CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;

Everything is fine :

mysql> CREATE DATABASE webmarketing_en CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

Exit

exit

 

How to add expire header on Ubuntu with Apache2 :

Edit your httpd.conf

  1. The module ‘mod_expires’ must be activated
  2. Add the new configuration

1) Activate mod_expires

sudo a2enmod expires
sudo /etc/init.d/apache2 restart

2) Add new lines on your httpd.conf

nano /etc/apache2/apache2.conf

Then add these lines at the end

ExpiresActive On
ExpiresByType image/gif “access 1 month”
ExpiresByType image/jpg “access 1 month”
ExpiresByType image/jpeg “access 1 month”
ExpiresByType image/png “access 1 month”
ExpiresByType text/css “access 1 month”
ExpiresByType text/js “access 1 week”
ExpiresByType application/javascript “access 1 week”

the restart

sudo /etc/init.d/apache2 restart

Example :

Check to make sure you have mod_rewrite enabled.

Under Apache 2+

sudo a2enmod rewrite && sudo service apache2 restart

or

sudo a2enmod rewrite && sudo /etc/init.d/apache2 restart

 

I share with you the solution :

Create a link /var/www

sudo ln -s /usr/share/phpmyadmin /var/www/
sudo nano /etc/apache2/apache2.conf

Then add the following line :

Include /etc/phpmyadmin/apache.conf

then Restart your apache

sudo service apache2 reload