How do I install mySQL on my Project
https://repl.it/@OblivionTDW/Realm
I am having trouble with my project. I want to be able to store the users info that login to my website, but I can't do that because i don't know how to install mysql on my project. Does anyone know how to? I'm a little frustrated. XD
Thank you guys or gals for all of your help, I just have one question, you guys said that I can use node.JS for my project, In that case, Do I still use Node.js in my current project and will is work or do I have to try and transfer my files to a different node.js project?
@OblivionTDW node.js is seprated from the HTML / css / js repl. You would click new repl and select Nodejs (javascript) and that will be the repl you run.
You will have to transfer all the files over. The main website libary for js is called "express" https://www.npmjs.com/package/express
I don't think you can use mySQL with just javascript. You will have to create a php file. There is a tutorial on php databases here: https://www.w3schools.com/php/php_mysql_intro.asp but I am not sure if this works on repl. Good luck!
Please upvote if this helps :)
@ArchieMaclean You can do mysql with javascript you dont need some type of external file thing. I have before and its really powerful when it comes to data storage for a javascript application.
@kpostal10 ok, that's cool. I didn't know about that :)
Sorry for posting misinformation :)
@ArchieMaclean All good, all you did was Cunningham's law "the best way to get the right answer on the internet is not to ask a question; it's to post the wrong answer."
@kpostal10 That's actually true
@ArchieMaclean Re looking at it he is using a html / css / js repl so what you put might be more valible, mine is a node.js implementation (I have since updated my main post above) where the "server" handles the login and displaying of webpages and allows the rendering of custom webpages where user information (varibles) can be passed through. However I dont think doing the type of repl he has currently can do a login system because of how it functions.
Relooking at the repl link provided if you are wanting to do login and have a website and stuff it might be better for you to look into node.js and use express. I dont think you could really do a login with a simple html thing uless you call an external server.
You can do login information however there will be no "main" server for it so logging in will do nothing for them.
(If you switch to node.js there are more powerful ways to render html pages with custom user information, React.js, pug (different format doestn use <> but still lets you do html), handlebars, or e.js)
You can use MySQL with just plain js. However the database itself would have to be hosted externally from repl.it (you can not install mysql on repl.it)
The following is how you would do it using express
https://dev.to/achowba/build-a-simple-app-using-node-js-and-mysql-19me
And for what I think you are wanting to do you would want the session store for MySQL
var MySQLStore = require('express-mysql-session')(session);
const mysql = require("mysql");
https://www.npmjs.com/package/express-mysql-session
Quick example of some code.
Also side note from personal experince call the session store option first in your app chai. (app.use(sessionStore) -> app.use("someViewthing") -> app.get('/index'))
If you follow that
All code provided does work in a production enviorment.
actually you can install mysql: https://expressjs.com/en/guide/database-integration.html#mysql @kpostal10