adonisjs migration issue with mysql - javascript

I'm trying to get the hang of adonisjs through this tutorial
I set up everything properly as instructed in there but I run into a problem when I type adonis migration:run.
The error I get on Terminal is Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'#'localhost' (using password: NO)
I have 0 experience with mysql and this confuses me. I'd appreciate some guidance/help here.
Cheers!

#katotopark, this means your MySQL server is rejecting the connection from the Adonisjs application. check for a file called (.env) in the root folder of your project and inside you will need to add the credentials for the connection the MySQL server. (probably user: root, password: the password you use when you installed MySQL)
your .env should look similar to this.
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root/or-another-mysql-user
DB_PASSWORD=your-database-user-password***
DB_DATABASE=the_name_of_your_database
Regards.

Related

psql database setup and connection on fedora linux

I've recently started work on a project that requires a psql database. I've followed numerous guides on setting up psql database on fedora, and have got my db up and running. I am able to connect into it using sudo -u postgres psql the project I am working on has a init-db bash scrip that is used to set up all the relation and tables for the database, which I am able to query once I am in the psql view on my terminal.
My issue is that no other application or software is able to connect to the database. At first I though it was a issue with the code left by previous developers but with further investigation I am unable to connect to it even using Jetbrain 'Database Tools and SQL' plug in.
I Have Tried a few thing to fix this (listed bellow) but none have worked
edited the postgresql.conf file to contain linsten_addresses = '*'
editted the pg_hba.conf file to have host all all 0.0.0.0/0
tried connecting to the database via JetBrains 'Database Tools and SQL' using localhost, my public ip, and my private ip
( yes I am sure i have to correct login details )
None of the above worked. I have tinkered with this for 4 hours now and have not gotten it to connect, so any suggestions would be much appreciated. If there is anything that i have missed out please ask and I will update the post with the needed information

I faced a problem when I used .env file in node.js

In my node.js project, I want to use environment variables for saving MongoDB's user name and password. When I directly use username and password then it is working completely. But when I used template string and process.env.varName then I got bad auth: Authentication failed error message.
ok: 0,<br/>
code: 8000,<br/>
codeName: 'AtlasError',<br/>
[Symbol(errorLabels)]: Set(0)<br/>
{}

getting javax.mail.AuthenticationFailedException on heroku

I am Using Heroku to deploy my java spring boot backend which utilizes the javamailsender. When testing locally before deployment, I was able to send emails and receive emails thru the application. But, ever since I deployed it on heroku, I have been receiving error whenever I try to send email.
Error Sending Email: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 534-5.7.9 Application-specific password required. Learn more at
2020-07-17T01:00:29.110458+00:00 app[web.1]: 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor r188sm8440648qkf.128 - gsmtp
2020-07-17T01:00:29.110462+00:00 app[web.1]:
I have seen plenty of articles/discussion forum where users encounter such problem and I tried to resolve using the solution that was given but was unsuccessful. I have the 2-Step-Verification on and turned on the less secure app but no luck. I also saw that doing App Password helped solved the issue but didn't really understand how to go about that in terms of my app on heroku. I have react frontend hosted on firebase and spring boot backend hosted on heroku. Any help would be appreciated. Thank you!
Nvm, I figured out what was causing this error. I guess I had to create an App Password and use that password that was created inside my application.properties.

How can I set database authentication in Mongodb - Is SSH Pipes better for MongoDB?

I have installed MongoDB in my computer. I did't define any password and username for the installation. I can see everything with Robo 3T.
Now I want to protect my database.
I have tried to set authentication for the database. I followed https://docs.mongodb.com/manual/tutorial/enable-authentication/ . It did not work.
I still can reach mongodb with robo 3t and see all information.
I have also tried to start mongodb with --auth parameter. I have define a configuration file looks like
And for starting mongodb
mongod -f C:\mongodb\conf\mongodb.conf
Mongodb has been started but, it did not ask any pass. And I can save simple data with Postman without authentication.
What I want to do:
Protect my database against Robo 3t. :))
I dont want to save any data without auth.
Building Nodejs connection string that include pass like
mysql://root:password#localhost:port/dbName
Here is my Nodejs index.js code
this is my model.
PS: I am very new in Nodejs and Mongodb.
EDIT: inside conf file

Node.JS MySql Module - Cannot Connect to Any Database - ECONNRESET

I'm trying to use the mysql module to connect to my database. But everytime, I get the following error: read eCONNRESET There is problem. (Note, that last part is from my console log. See below.)
I don't think this is a problem with database security settings. I've been trying to connect to my new database (hosted on AWS) for the last several days with no luck. Then, just now I attempted to connect to an Azure database that has been running smoothly for a couple years. Same problem: read eCONNRESET.
By the way, if I randomly change the host string to something invalid, my code returns an error saying the host wasn't found. So that tells me it's working to some extent.
I'm very new to the coding world and need all the help I can get.
Here's my code:
console.log('starting Launch');
var mysql = require('mysql');
var connection = mysql.createConnection({
host : '....windows.net',
user : 'test',
password : 'test',
port : '1433'
})
console.log('step2')
connection.connect(function (err) {
if (!err)
console.log("conncetd");
else
console.log(err + "There is problem");
});
Copy full error message.
Check connectivity to your DB instance, use nmap (linux) or telnet (windows). If you can't reach host - check your local machine and server firewall, restrictions. If you can, go to 2.
Try to use different MySQL client, MySQL WorkBench, HeidiSQL, DBeaver.
If you can't - than something wrong with MySQL configuration. If you can, go to 3.
Copy info about: OS, node version, mysql module version.
you could try
mysql.createPool({});
instead of
mysql.createConnection({})

Categories

Resources