-
Notifications
You must be signed in to change notification settings - Fork 2.5k
changeUser return err #482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you post the output when setting |
var mysql = require('/data0/npm/node_modules/mysql');
var connection = mysql.createConnection({
host : '10.75.19.79',
port : 9601,
user : 'maya',
password : 'maya123456',
database : 'test',
debug : true,
});
connection.connect();
connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
if (err) throw err;
console.log('The solution is: ', rows[0].solution);
});
//connection.changeUser({}, function (err) {
console.log('err:', err);
});
connection.end(); output: <-- HandshakeInitializationPacket
{ protocolVersion: 10,
serverVersion: '5.1.42-log',
threadId: 10148466,
scrambleBuff1: <Buffer 64 3e 48 2f 50 27 6e 75>,
filler1: <Buffer 00>,
serverCapabilities1: 63487,
serverLanguage: 33,
serverStatus: 2,
serverCapabilities2: 0,
scrambleLength: 0,
filler2: <Buffer 00 00 00 00 00 00 00 00 00 00>,
scrambleBuff2: <Buffer 26 57 63 6d 7b 42 76 4b 52 3b 6e 39>,
filler3: <Buffer 00>,
pluginData: undefined,
protocol41: true }
--> ClientAuthenticationPacket
{ clientFlags: 193487,
maxPacketSize: 0,
charsetNumber: 33,
filler: undefined,
user: 'maya',
scrambleBuff: <Buffer 23 83 02 c5 b3 1a 90 a2 d2 7f 99 ec db 41 03 55 da 86 c8 29>,
database: 'test',
protocol41: true }
<-- OkPacket
{ fieldCount: 0,
affectedRows: 0,
insertId: 0,
serverStatus: 2,
warningCount: 0,
message: '',
protocol41: true,
changedRows: 0 }
--> ComQueryPacket
{ command: 3, sql: 'SELECT 1 + 1 AS solution' }
<-- ResultSetHeaderPacket
{ fieldCount: 1, extra: undefined }
<-- FieldPacket
{ catalog: 'def',
db: '',
table: '',
orgTable: '',
name: 'solution',
orgName: '',
filler1: <Buffer 0c>,
charsetNr: 63,
length: undefined,
type: 8,
flags: 129,
decimals: 0,
filler2: <Buffer 00 00>,
default: undefined,
zeroFill: false,
protocol41: true,
fieldLength: 3 }
<-- EofPacket
{ fieldCount: 254,
warningCount: 0,
serverStatus: 2,
protocol41: true }
<-- RowDataPacket
{ solution: 2 }
<-- EofPacket
{ fieldCount: 254,
warningCount: 0,
serverStatus: 2,
protocol41: true }
The solution is: 2
--> ComChangeUserPacket
{ command: 17,
user: 'maya',
scrambleBuff: <Buffer 23 83 02 c5 b3 1a 90 a2 d2 7f 99 ec db 41 03 55 da 86 c8 29>,
database: 'test',
charsetNumber: 33 }
<-- ErrorPacket
{ fieldCount: 255,
errno: 1047,
sqlStateMarker: '#',
sqlState: '08S01',
message: 'Unknown command' }
err: { [Error: ER_UNKNOWN_COM_ERROR: Unknown command] code: 'ER_UNKNOWN_COM_ERROR', fatal: true } |
Are you able to use any of the |
to dougwilson: |
I've run the same test with php mysqli_change_user(), and it works, so there's no problem with mysql. |
I read the mysql protocol: and found that character-set should be 2 bytes, but in ComChangeUserPacket.js it's 1 byte. writer.writeUnsignedNumber(2, this.charsetNumber); And run the test again, it seems ok now: { command: 17,
user: 'root',
scrambleBuff: <Buffer 4e 62 44 33 f7 8f 73 2c 2b 70 1d b5 7a 73 9a 61 d8 cb f8 01>,
database: 'test',
charsetNumber: 33 }
<-- OkPacket
{ fieldCount: 0,
affectedRows: 0,
insertId: 0,
serverStatus: 2,
warningCount: 0,
message: '',
protocol41: true,
changedRows: 0 } Can you confirm and fix it? |
@freedaxin I think you're right. If you send a patch, I'd be happy to merge it. |
Should be fixed by #498 now. |
ok |
// ... connect and query
connection.changeUser({}, function (err) {
console.log(err);
});
callback err:
{ [Error: ER_UNKNOWN_COM_ERROR: Unknown command] code: 'ER_UNKNOWN_COM_ERROR', fatal: true }
my mysql version is 5.1.42, which should have support change user command.
The text was updated successfully, but these errors were encountered: