Skip to content

Commit 277bdd1

Browse files
change connection suggestions for cli on windows
1 parent 92918b3 commit 277bdd1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/cli.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@ async function main() {
4040
console.log('Creating ephemeral MySQL database...')
4141
const db = await createDB(options);
4242
console.log(`A MySQL databases has been successfully created with the following parameters:\n\nUsername: ${db.username} \nDatabase Name: ${db.dbName} \nPort: ${db.port} \nX Plugin Port: ${db.xPort} \nSocket: ${db.socket} \nX Plugin Socket: ${db.xSocket}\n`)
43-
console.log(`If you want to use the MySQL CLI client to connect to the database, you can use either commands: \nmysql -u ${db.username} -P ${db.port} --protocol tcp \nOR\nmysql -u ${db.username} --socket ${db.socket}`)
43+
if (process.platform === 'win32') {
44+
//The connection information logs will be different for Windows compared to other platforms.
45+
//Windows uses mysqlsh instead of mysql to invoke the client shell, needs a --sql flag to be put into SQL mode, and also does not have a protocol flag.
46+
//Also according to https://bugs.mysql.com/bug.php?id=106852, you cannot log into a MySQL database with a named pipe for the first connection so a socket connection suggestion
47+
//should only be displayed for non-Windows platforms.
48+
console.log(`If you want to use the MySQL CLI client to connect to the database, you can use the following command: \nmysqlsh --sql -u ${db.username} -P ${db.port}`)
49+
} else {
50+
console.log(`If you want to use the MySQL CLI client to connect to the database, you can use either commands: \nmysql -u ${db.username} -P ${db.port} --protocol tcp \nOR\nmysql -u ${db.username} --socket ${db.socket}`)
51+
}
4452
}
4553

4654
main()

0 commit comments

Comments
 (0)