Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt.
The installation of drupal fails with the following error message:
sql-query: SELECT 1; [0.28 sec, 7.2 MB] [notice]
Executing: mysql --defaults-extra-file=/tmp/drush_Av3Ykw --database=love_drupal --host=127.0.0.1 --port=3307 --silent < /tmp/drush_pWXzpm > /dev/null
sql-query: DROP DATABASE IF EXISTS love_drupal; CREATE DATABASE [notice]
love_drupal /*!40100 DEFAULT CHARACTER SET utf8 */; [0.33 sec, 7.21
MB]
Executing: mysql --defaults-extra-file=/tmp/drush_fulXsQ --database=information_schema --host=127.0.0.1 --port=3307 --silent < /tmp/drush_TWwWoG
ERROR 1045 (28000): Access denied for user 'love'@'localhost' (using password: YES)
Failed to create database: ERROR 1045 (28000): Access denied for user [error]
'love'@'localhost' (using password: YES) [0.38 sec, 7.21 MB]
My mysql version is: mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1 which is below the minimal requirement for D8, however, the DB I am actually using is MariaDB 10.0.
Notice that the following command, exectuted from the command line, works:
mysql --defaults-extra-file=~/.my.mariadb.cnf --database=information_schema --host=127.0.0.1
while the following does not:
[love@arcturus ~]$ mysql --defaults-extra-file=~/.my.mariadb.cnf --database=information_schema --host=127.0.0.1 --port=3307
ERROR 1045 (28000): Access denied for user 'love'@'localhost' (using password: YES)
My Solution
I had a look at drush/src/Sql/SqlMysql.php (see) and changed the generated file to include the port number:
#This file was written by Drush's Sqlmysql.php.
[client]
user="{$dbSpec['username']}"
password="{$dbSpec['password']}"
host="{$dbSpec['host']}"
port="{$dbSpec['port']}"
EOT;
Since I am using a different version than the linked version above I wrote:
#This file was written by Drush's Sqlmysql.php.
[client]
user="{$this->db_spec['username']}"
password="{$this->db_spec['password']}"
host="{$this->db_spec['host']}"
port="{$this->db_spec['port']}"
EOT;
in drupal/vendor/drush/drush/lib/Drush/Sql/Sqlmysql.php. composer lists my drush as:
Then I commented the setting of host and port as command line arguments.
// EMPTY host is not the same as NO host, and is valid (see unix_socket).
elseif (isset($this->db_spec['host'])) {
//$parameters['host'] = $this->db_spec['host'];
}
if (!empty($this->db_spec['port'])) {
//$parameters['port'] = $this->db_spec['port'];
}
and it worked. However, the database is now love_drupal and not information_schema anymore.
The Problem
The installation of drupal fails with the following error message:
My mysql version is:
mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
which is below the minimal requirement for D8, however, the DB I am actually using is MariaDB 10.0. Notice that the following command, exectuted from the command line, works:while the following does not:
My Solution
I had a look at
drush/src/Sql/SqlMysql.php
(see) and changed the generated file to include the port number:Since I am using a different version than the linked version above I wrote:
in
drupal/vendor/drush/drush/lib/Drush/Sql/Sqlmysql.php
. composer lists my drush as:Then I commented the setting of
host
andport
as command line arguments.and it worked. However, the database is now
love_drupal
and notinformation_schema
anymore.