I created ExpressJS MVC app using MySQL as DB with Yeoman generator
and in config.js
I want to change MySQL connection strings, but I don't know to specify password in string.
my string is mysql://root@localhost:3306/
Please help me.
Enter mysql.exe -uroot -p , and MySQL will launch using the root user. MySQL will prompt you for your password. Enter the password from the user account you specified with the –u tag, and you'll connect to the MySQL server.
Driver={mySQL};Server=myServerAddress;Port=3306;Option=131072;Stmt=;Database=myDataBase;User=myUsername;Password=myPassword; The driver defaults to port value 3306, if not specified in the connection string, as 3306 is the default port for MySQL.
Here's generic connection-string parser, which offers a flexible optional syntax, while adhering to the URL syntax. Works in any environment.
const { ConnectionString } = require('connection-string');
const cs = new ConnectionString('mysql://user:password@host:port/dbName');
Password and DB name also a part of connection string.
Ex: mysql://root:password@localhost:port/dbName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With