Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how do i connect sql database ? #50

Closed
ameinabdi opened this issue Sep 20, 2019 · 12 comments
Closed

how do i connect sql database ? #50

ameinabdi opened this issue Sep 20, 2019 · 12 comments
Labels
question Further information is requested

Comments

@ameinabdi
Copy link

ameinabdi commented Sep 20, 2019

How can read about sql db connection?

when i select mysql database i got this error to start project

Screenshot 2019-09-20 at 2 33 36 PM

@ghost ghost self-assigned this Sep 20, 2019
@ghost ghost added the question Further information is requested label Sep 20, 2019
@ghost
Copy link

ghost commented Sep 20, 2019

Hi @ameinabdi,
there is the orm.config.ts where is stored db information. For dev it will be always sqlite created on app startup.

@ameinabdi
Copy link
Author

ameinabdi commented Sep 20, 2019

thanks @amanganiello90
i have added my info about database in that file but i still it doesn't work so did you test sql before now ?

@ghost
Copy link

ghost commented Sep 20, 2019

What db have you choosen in the related question?

@ameinabdi
Copy link
Author

mysql

@ghost
Copy link

ghost commented Sep 20, 2019

What command are you using to startup application? Write in order the commands.

@ameinabdi
Copy link
Author

jhipster --blueprint nodejs

@ghost
Copy link

ghost commented Sep 20, 2019

That command is for generation.. I said about startup.. however for mysql prod db, the connection created is:

ormconfig = {
        name: 'default',
        type: 'mysql',
       url: 'mysql://localhost:27017/<your-app-name>,
        synchronize: true,
        logging: false,
        entities: [__dirname + '/domain/*.entity{.ts,.js}'],
    };

Change url with your mysql instance.

@ameinabdi
Copy link
Author

i run this command inside the server folder
npm start

@ghost
Copy link

ghost commented Sep 20, 2019

i run this command inside the server folder
npm start

Ok, so you are using sqlite dev db, not mysql.. paste in your server/src/orm.config.ts the orm.config.ts content

@ameinabdi
Copy link
Author

but i don't need to use sqlite. i need to use mysql database

@ghost
Copy link

ghost commented Sep 20, 2019

Then, replace in the if of Prod section the mysql source configuration and run:

set NODE_ENV=prod&&npm start

Please attention that in your db instance must be created the 3 user management tables, otherwise the initial db seed insert fails.

To disable it comment this line

@ameinabdi
Copy link
Author

okey thanks a lot mr @amanganiello90

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant