Comments (4)
It is working if I add the following code (each time).
connection.query("SET CHARACTER SET utf8mb4");
connection.query(
'INSERT INTO emails ( `subject` ) VALUES (" subject 👋" );',
);
from node-mysql2.
@arshidkv12 can you try using UTF8MB4_GENERAL_CI
as charset value?
I suspect your charset is not recognised. If that's the case we should probably warn users
The reason your second example works is that we track state variables updates and is "CHARACTER SET" variable is updated connection knows that - see
node-mysql2/lib/packets/resultset_header.js
Lines 65 to 68 in 489154f
from node-mysql2.
I attempted the code below, but it didn't work.
var connection = mysql.createConnection({
host: config.DB_HOST,
user: config.DB_USERNAME,
password: config.DB_PASSWORD,
database: config.DB_DATABASE,
charset: 'UTF8MB4_GENERAL_CI'
});
OR
var connection = mysql.createConnection({
host: config.DB_HOST,
user: config.DB_USERNAME,
password: config.DB_PASSWORD,
database: config.DB_DATABASE,
charsetNumber:45
});
from node-mysql2.
How to fix it? Can I set charsetNumber:45
by hardcode?
from node-mysql2.
Related Issues (20)
- read: connection reset by peer HOT 1
- Causing Too many connections error on mysql server HOT 6
- Too many connection HOT 14
- Cannot delete rows using WHERE IN HOT 4
- Error: Packets out of order. Got: 0 Expected: 10 HOT 1
- Specifying rejectUnauthorized=true and verifyIdentity=false, unreachable code HOT 3
- [SSL Problem] Trying to connect with protocol TLSv1 raise an issue
- TypeError: Cannot read properties of undefined (reading 'createPool') HOT 10
- Bulk insert thousands of records results in ER_PS_MANY_PARAM. Should I split my records? HOT 1
- Timeout Issue despite my Connection Settings Being Correct HOT 1
- Can't get the database name after use db command HOT 3
- Alternative for "ResultSetHeader.changedRows" HOT 2
- prepare is not a function
- npm error when using typecast
- namedPlaceholders cannot be disabled at query level
- Remove error being logged for invalid options AND please do not make it ever throw an error for this! HOT 1
- Update examples HOT 1
- Pool not releasing connections if maxIdle is not set HOT 14
- Can't add new command when connection is in closed state
- Weird bug connection pool close just because of select id HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-mysql2.