0

I have Ubuntu 20.04. I installed Apache2 and MySQL 8 on it, but I can't install Drupal 8. When I try to add the database information like usual, I get the following error message.

enter image description here

I traced the possibilities of the error and be sure of solving it, but it still doesn't work. I didn't find instructions on the net to work on it.

3
  • Looks like an issue connecting to the database. Are you able to connect to it using a mysql client and command line? Also you are installing an older dev version of Drupal 8, by the way. – Kevin Jun 9 '20 at 10:44
  • @Kevin yes i can connect to it using my root user, I install last version of Drupal 8.9 and I read about mysql 8 work on drupal 8.6 or latest – Tasneem Jun 9 '20 at 11:00
  • Ok. The picture says 8.8.7-dev. – Kevin Jun 9 '20 at 13:00
2

This might be an issue with the new ways MySQL 8 does authentication.

Read more about that in this answer: What is mysql_native_password?

From the docs: MySQL Secure Deployment Guide / Enabling Authentication

You need to adjust the authentication method for the MySQl user you're using with Drupal (seems to be root from your screenshot). You can't do that through Drupal, you have to login MySQL through terminal or go through some other way of configuring your installed database server.

If switching to the new way of authentication isn't an option then you can change the user to use the old way of authenticating with mysql_native_password:

alter user 'root'@'localhost' identified with mysql_native_password by 'whateveryourpasswordis';
flush privileges;

After that Drupal should be able to connect with the chosen database.

This is probably unrelated to your problem, but I've had problems in the past with some special characters in the password (not the database name), I couldn't use & nor # IIRC.

0

I think that the database name is not allowed. Try to create a new database and name it according to the following conventions.

  • Database names must only consist of the letters a to z (both lower and upper case allowed), the numbers 0 to 9, and the underscore (_) or dash (-) symbols

  • Database names are case-sensitive

  • Database names starting with an underscore are considered to be system databases, and users should not create or delete those

  • The maximum allowed length of a database name is 64 bytes

Naming conventions are taken from Database Names.

2
  • The MySQL restrictions on schema object names (which also include database names) are listed on 9.2 Schema Object Names. It doesn't say the database name cannot contain spaces, but that they cannot end with space characters. – kiamlaluno Jun 9 '20 at 8:27
  • thank you for answer, I try with multi names of database : drupal8, drupal89 , .... and no one work – Tasneem Jun 9 '20 at 11:01
0

Here is what I did on a fresh install of ubuntu 20.04.

First we'll need to install lamp:

apt install lamp-server^

Then install php 7.4 gd

apt install php7.4-gd

Setup mysql securely:

sudo mysql_secure_installation

Enable apache rewrite and restart:

a2enmod rewrite; service apache2 restart

Install composer:

curl -sS https://getcomposer.org/installer -o composer-setup.php

Install drush launcher so u can use drush which needs to be installed individually per site (https://github.com/drush-ops/drush-launcher):

wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar

Next, create a mysql user so you can create databases for your drupal install: https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

Now install drupal:

composer create-project drupal/recommended-project drupal 

OR for drupal 8.9

composer create-project drupal/recommended-project:8.9 drupal

Then cd into that directory and install drush:

composer require drush/drush

Install drupal:

drush site:install

Enter all your info and it will auto install. Remember to link this directory to your apache folder /var/www/html or however you want to do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.