Closed manatax closed 8 years ago
As far as I'm aware you cannot specify a database name when connecting to a MySQL server, you can only specify a username to log in as. It is possible to specify a default schema for that user to use though.
If you look at the last example (Data population SQL) in tha package description, the database (or schema in MySQL terms) is set by the term "USE
Cheers
https://www.npmjs.com/package/mysql#introduction the database property let's you select the schema.
Ezequiel Rodrigué
On Wed, Mar 9, 2016 at 4:47 PM, snapperben notifications@github.com wrote:
As far as I'm aware you cannot specify a database name when connecting to a MySQL server, you can only specify a username to log in as. It is possible to specify a default schema for that user to use though. If you look at the last example (Data population SQL) in tha package description, the database (or schema in MySQL terms) is set by the term "USE ;" which means all subsequent SQL statements would use that database/schema. If you wanted to use different databases/schemas in the same file then you wouls have to use two or more USE statements or refer to a table as .. Another alternative is to set up several users, each with a different default schema/database. That would then mean that you effectively select the database by choosing the user you connect to MySQL as. I hope that answers your question....if not please feel free to ask for a clarification. It's nearly 1 AM here in the UK so I'll get back to you in 8 hours or so.
Cheers
— Reply to this email directly or view it on GitHub https://github.com/snapperben/gulp-mysql-command-file-processor/issues/5#issuecomment-194591332 .
I'll investigate that
This has now been fixed...please check
Cheers
Ben
On Thu, Mar 10, 2016 at 1:06 AM, manatax notifications@github.com wrote:
https://www.npmjs.com/package/mysql#introduction the database property let's you select the schema.
Ezequiel Rodrigué
On Wed, Mar 9, 2016 at 4:47 PM, snapperben notifications@github.com wrote:
As far as I'm aware you cannot specify a database name when connecting to a MySQL server, you can only specify a username to log in as. It is possible to specify a default schema for that user to use though. If you look at the last example (Data population SQL) in tha package description, the database (or schema in MySQL terms) is set by the term "USE ;" which means all subsequent SQL statements would use that database/schema. If you wanted to use different databases/schemas in the same file then you wouls have to use two or more USE statements or refer to a table as .. Another alternative is to set up several users, each with a different default schema/database. That would then mean that you effectively select the database by choosing the user you connect to MySQL as. I hope that answers your question....if not please feel free to ask for a clarification. It's nearly 1 AM here in the UK so I'll get back to you in 8 hours or so.
Cheers
— Reply to this email directly or view it on GitHub < https://github.com/snapperben/gulp-mysql-command-file-processor/issues/5#issuecomment-194591332
.
— Reply to this email directly or view it on GitHub https://github.com/snapperben/gulp-mysql-command-file-processor/issues/5#issuecomment-194600170 .
It would be great if you include the option to select a database by name. It's just a matter of adding the 'database' property to the createConnection method call.