Database I have on heroku doesn't support special characters so I want to set utf8 encoding. When I was working on local version I simply changed config files but I wonder how I can achieve this using Heroku's DB.
This added to connection url doesn't help:
?useUnicode=true&characterEncoding=UTF-8
I resolved this problem when I set this ?useUnicode=true&characterEncoding=UTF-8 into "Config Vars" on site heroku.com in section "settings" after question mark. Look up at image description here http://images.vfl.ru/ii/1588540106/e4c9cfa2/30400062.jpg
Switch from the ClearDB heroku add-on JawsDB MySQL solve my problem.
Related
I'm writing a new project that utilises MySQL , There is no problem with the app I'm working on, but when the app recives the output from my sql server it immediately rejects it as null. When accessing my SQL server on port 3306 I am getting strange garbled messages back as well as the short message 'packets out of order.' In my setup I have, MAMP, Docker, Apache server and PHP. I can access each service on its respective port just fine.
1) I have looked into this by running console in the browser which reports the text being incorrectly formatted to something that isn't utf-8
2) I have followed this guide
https://medium.com/#manish_demblani/breaking-out-from-the-mysql-character-set-hell-24c6a306e1e5 and the results that my sql server have churned out are as follows
enter image description here
My question is this. Why is MySQL set up in this strange fashion? Why is it presenting in CP850 /DOS/ Latin? Are there no defaults/config files to change or is it done through windows somewhere
It seems you somehow messed up the client configuration (connection string, [client]-section of your cnf file (on the system that you started the mysql console on), ...). It tells your server to send data in cp850. Not sure why you would get packets out of order, maybe you have an additional underlying problem (very old library maybe?), but I'd start there. It's unclear: did you follow the blog post and then had problems, or was that a solution attempt? In any case, try to focus your attention on the client. Try to undo changes you made. MySQL uses utf8 by default for a long time now. – Solarflare
My asp.net core website talks to mysql using MySql.Data.MySqlClient.The connection string is set in appsettings.json as:
"ConnectionStrings": {
"DefaultMySqlConnection": "Server=localhost;Database=mydb;Uid=someuser;Pwd=somepassword;"
}
In mysql server, which is deployed on the same ubuntu server with the app, I've added the user 'someuser'#'localhost'and granted the permissions accordingly.
I'm sharing this server machine with a friend, who already has his own website deployed, including a db on the same mysql server. I didn't think this could cause a problem, until I see in the log that my website is trying to authenticate on the mysql server as user 'someuser'#'myfriendssite.com', instead of the expected 'someuser'#'localhost'.
So at what stage could the localhost in connection string be replaced to myfriendssite.com? The only place I know and checked is the /etc/hosts file, which looks pretty standard:
And, maybe this will be obvious if the above question is answered: how does one avoid this?
Thank you!
Turns out it's using the /etc/hostname, as explained in here.
I am working on emoji's to work with mysql database.
First thing my application uses RDS with version "5.6.22". I used the following link to handle emoji's for RDS mysql DB:
http:/aprogrammers.blogspot.in/2014/12/utf8mb4-character-set-in-amazon-rds.html
As link say's we have to update character set to "utf8mb4" so I did the changes accordingly.
Please find attached image having "Character Set" related variables settings for RDS (RDS-config.JPG).
Still after doing correct configuration, I am getting error saying as follow:
"Incorrect string value: '\xF0\x9D\x8C\x86' for column 'column_name' at row 1 ".
Second thing is that when I am working with local mysql DB which has version "5.7.15". I did that same changes with Character set variables for "utf8mb4". For details please check attached image (Local-config.JPG).
Now if I connect to local DB, emoji works fine.
I can anyone help me out with this issue.
Thanks in advance.
Harshvardhan Pawar
RDS Config details:
enter image description here
Local Config details:
enter image description here
I had very similar issue. The problem was that I set utf8mb4 for Parameter Group which was not selected as default group of my RDS instance.
I'm connecting openfire with mysql using jdbc. After setting characterEncoding=UTF-8 in DB connection URL everything works fine and utf8 data could be written successfully into db. However whenever openfire restarts encoding no longer works, and everything saved into DB becomes "???".
I've googled a lot on this, but everything I found (like this and this) are mostly tutorial on initial setting, the one I already succeeded. The key of successful initial setting I believe is [1] have utf-8 in your db and [2] use characterEncoding=UTF-8 in your JDBC connection. The problem is it fails AFTER openfire restart, and I couldn't find any solution to this.
If anyone has any slight idea on how to solve this issue please help. I believe I'm not the only one sufferred from this.
I've found the solution myself.
Turns out it's the escaping problem on serverURL saved in openfire.xml. Apparently the & character is escaped twice and cause the wrong url:
<serverURL>jdbc:mysql://localhost:3306/avmcdb?rewriteBatchedStatements=true&characterEncoding=UTF-8</serverURL>
Should be
<serverURL>jdbc:mysql://localhost:3306/avmcdb?rewriteBatchedStatements=true&characterEncoding=UTF-8</serverURL>
After modifying this line and restart openfire, everything works well.
My website is in Azure and the Database is MySQL, ASP.NET 4.0
When I run on localhost (Connected to production DB), I can read-write to the DB in utf8.
When I run on Azure (aka, production) I can only read DB in utf8 but when trying to write it inserts '???? ???? ????'.
So, If it's the same Database and same code, the difference must be IIS, no?
Can anyone assist me how to define it to work?
(btw, the MySQL connection-string has 'charset=utf8')
update:
the web.config file has:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
A Ha!
It was Azure!
I needed to go to the Azure Portal and change the connection string there as it ignores my web.config connection string and uses that one instead.
By the way, adding the charset=utf8 there did the trick.
I hope someone will find it useful.