Support

Site Restoration

#38163 Trouble Connecting to MYSQL Solved

Posted in ‘Site restoration’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

PHP version
7.4.33
CMS Type
Joomla!
CMS Version
3.10.11
Backup Tool Version
8.2.3
Kickstart version
7.1.2

Latest post by nicholas on Tuesday, 13 December 2022 01:15 CST

[email protected]

I am in the process of upgrading a Joomla site from 3.10.11 to 4.2

I created a directory to restore into and have a subdomain pointing to it.

When I got to the database restoration page it kept failing to connect to MySQL.

I finally saw that I had a trailing space on the end of my sql username.  Once I removed the trailing space it worked fine.

I just wanted you to know as I was unsure if this is how you would expect it to work.  Would it be better to trim any leading and trailing spaces on the username?

-Geff

nicholas
Akeeba Staff
Manager

Spaces, unfortunately, can be part of a MySQL server username.

It is very counter-intuitive, it is extremely rare, but since I got one report about someone not being able to connect to such a server with this kind of a username I have a user on my local MySQL server with the username space  (since you can't really see it unless you view the source of the HTML reply, it is space followed by a space character). Yes, you can use it just fine to log into the MySQL server. It's maddening, but it's real.

Since leading and trailing spaces are legitimate username characters I am unfortunately unable to trim the username provided as it would break legitimate connections with this kind of uncommon username.

I wish I was making this up. My life would be far simpler if I could just yeet invisible leading and trailing characters from username fields. As you have intuited, it's not an uncommon problem.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

[email protected]

Nicholas,

Thank you for the quick reply.  I wondered if a space might be allowed in user names so I understand why you need to allow it.

Perhaps you could format the username field such that any leading or trailing spaces were obvious.  Maybe use a contrasting text background color different from the page background color.  This way a leading or trailing space would show as a colored blank space. The only reason it happened to me was I highlighted and copied the username from a file and accidentally copied an extra blank space after the username, then when I pasted it into the field it pasted in the extra space at the end.

I really appreciate your work. Akeeba Backup has saved me countless hours.

-Geff

nicholas
Akeeba Staff
Manager

There is no way to format an HTML input field to make spaces obvious. You cannot apply a different background to the input text than the rest of the field's background, for example. Nor can you tell a browser to render visible whitespace like Word does for example.

You can, however, spot that you have an extra space because the caret is not adjacent to the last character you input but off to the right. This is the tell-tale sign that you have entered an errant trailing space.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!