In a Fedora system, I need to convert the Owncloud's SQLite database into a MySQL/MariaDB database I started installing MySQL:

# systemctl enable mysqld
# systemctl start mysqld
$ mysql_secure_installation


$ mysql -u root -p
  CREATE USER 'owncloud_user'@'localhost' IDENTIFIED BY '12345';
  GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud_user'@'localhost' IDENTIFIED BY '12345';

and let's assume that owncloud_user's password is 12345 Now, from Owncloud 7.0 admin manual, entering

# php occ db:convert-type --all-apps mysql owncloud_user owncloud

I have been prompted for:

What is the database password?

Database password? I only created a password for user owncloud_user, so I entered the password 12345 but I obtain error

SQLSTATE[HY000] [1045] Access denied for user 'owncloud_user'@'localhost' (using password: YES)

Additional infos:

the machine has IPv6 enabled

MariaDB [(none)]> SELECT user, host FROM mysql.user;
| user          | host      |                                                                                                                                                             
| root          | |
| root          | ::1       |
| owncloud_user | localhost |
| root          | localhost |
  • 1
    You refer to both '12345' and '123456' as password values. I presume that these are stand-ins for hte real password you use, and not the problem, but it is of course important that the password actually matches what you think it is. (If it really is that simple, then I'll make this an answer for the bounty). – mc0e Nov 16 '14 at 12:21
  • @mc0e 123456 was a mistype mistake during writing the question. $ mysql -u owncloud_user -p -t owncloud returns: Enter password: then ERROR 1045 (28000): Access denied for user 'owncloud_user'@'localhost' (using password: YES) – Germano Massullo Nov 16 '14 at 17:37

You need to reload the privileges from the grant tables in the mysql database. You can do this with:

$ mysql -u root -p
| improve this answer | |
  • 4
    Incorrect. The grant statement does that for you. It's only necessary when you manipulate the 'mysql' database via sql statements. – mc0e Nov 16 '14 at 12:20
  • I deleted the database and the users. I noticed that in the Fedora wiki guide, the command FLUSH PRIVILEGES was missing after user creation. I entered it and now the conversion process starts correctly!!! – Germano Massullo Nov 17 '14 at 7:04
  • I'm glad this solved your problem @Caterpillar , but it's inconsistent with the question as you put it. IT suggests you did something to manipulate your access tables that's left out of what what you describe in the question. I don't think we should leave this as it is for others to read, and suggest that the question and/or the answer wants editing. – mc0e Nov 17 '14 at 7:48
  • @mc0e if you suggest me what I have to write in the question I will make some edits – Germano Massullo Nov 17 '14 at 7:51
  • @Caterpillar Were there other things you tried doing to the mysql.user or mysql.db tables in the course of trying to get things to work? – mc0e Nov 17 '14 at 7:52

Can you try specifying and/or ::1 , like this

$ mysql -u root -p
  CREATE USER 'owncloud_user'@'' IDENTIFIED BY '12345';
  CREATE USER 'owncloud_user'@'::1' IDENTIFIED BY '12345';
  GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud_user'@'';
  GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud_user'@'::1';

The reason is this: http://dev.mysql.com/doc/refman/5.0/en/connecting.html

On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to connect to the local server by using a Unix socket file.

| improve this answer | |
  • I think this is likely the correct answer. When the connection command explicitly uses '-h localhost' it forces TCP. The incoming request is then considered to come from '' rather than 'localhost' and looked up against the database accordingly. What I don't understand though is why a 'flush privileges' command would then fix matters? Or was the test different afterwards, perhaps leaving off the '-h localhost'? – mc0e Nov 17 '14 at 7:58
  • I tried for days all different types of localhost / local ip addresses, but that was not the problem – Germano Massullo Nov 25 '14 at 9:09

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.