Why does this query return no results?
See original GitHub issueCode:
const conn = mysql.createConnection({
host: 'localhost',
port: 3306,
username: 'root',
password: '',
multipleStatements: true,
timeout: 5000
});
conn.connect((err) => {
if (err) {
// console.log(err.code);
// console.log(err.fatal);
// console.log(err.sql);
// console.log(err.sqlState);
// console.log(err.sqlMessage);
dialog.showErrorBox('Uh-Oh!', err.code);
return;
}
const SQL = 'SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = "' + db + '"';
conn.query(SQL, function (err, rows, fields) {
if (err) {
dialog.showErrorBox('Uh-Oh!', err.code);
return;
}
console.log(SQL);
console.log(rows); // []
console.log(fields);
});
});
When SQL
is dumped it returns:
SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA = "survive"
However rows is always an empty array. When I run the exact query in PMA then:
I am not getting errors and I have tried connecting with debug: true
too.
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (7 by maintainers)
Top Results From Across the Web
Why Query is not returning any results?
Typically, when no rows are returned from a query it is down to one of two things: Either your JOINs are resulting in...
Read more >Getting "Query does not returns results" SQL exception
For INSERT , UPDATE or DELETE use the executeUpdate() method and for SELECT use the executeQuery() method which returns the ResultSet .
Read more >Query does not return any results - Microsoft Q&A
Query does not return any results. Hello,. I am running the following query on SSIS on the AdventureWorks2012 database.. select
Read more >Query not returning results
No results were found for your search query. Tips. To return expected results, you can: Reduce the number of search terms. Each term...
Read more >Query Returning Zero Rows Unexpectedly
The hidden culprit here is the presence of NULL values in the column referenced in the subquery. We need to note that NULL...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Script47 FWIW you may want to
SELECT * FROM mysql.user WHERE user = ''
. Your server is allowing anonymous logins, and you probably want to delete those empty-username entries. Had they not been there, you would have failed to connect and the error message would likely have identified you as''@'localhost'
, which might have been a tipoff.Probably because there is no such option as
username
; it’s calleduser
: https://github.com/mysqljs/mysql#connection-options