I have a Laravel App that is using MySQL as its main DB. We are now trying to implement the Azure MySQL service, but the usernames comes with an '@' in it.
For example, if my server name is "test", then to connect from cli: mysql -htest.mysql.database.azure.com -u'someuser@test' -p
I can connect from Java and Go with no problem, but Laravel can't handle the '@' in the username. It takes the string after '@' as the host and tries to connect to it, but it doesn't resolve to any IP, so the connection fails.
I have tried to escape the sign like 'user\\@test', ' user@test
' and 'userU+0040test', but nothing works. The server always returns this error:
SQLSTATE[HY000] [9002] The connection string may not be right. Please visit portal for references
The Azure portal shows the code to connect using mysqli
, and that works, but I cannot use that from Laravel (I think?).
How could I make this connection work?
Thanks
Try using double qoutes around your username. Like eg "someuser@test"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.