Set up a website with a database on a webserver

February 22, 2016 1.2k views
MySQL PHP LAMP Stack Ubuntu

Hello,
a while ago I set up a teamspeak server on an ubuntu 14.04 x64 server, no problems with this whatsoever. But recently I also wanted to make this server perform as an webserver. So I installed the LAMP stack and phpmyadmin. And I transfered my files trough WinSCP. When I go to the ip-adres I can see the homepage but I can't really go further than that because all of the other pages require the database. So my question is, where and how do I put the mysql tables? Everything worked when I ran the site on my local WAMP so I would like it if it also worked on a real webserver.
I hope someone can help me.
Thanks in advance!

5 comments
  • Which CMS are you using? Wordpress?

  • You can set up all your mySQL tables, etc.. via (terminal)/command line, and there's a couple GUI mySQL things out there. Here's a small example of command to create your database, after that it's a matter of the actual tables you need.. and so on. I know this leaves a lot to do.. but there's plenty of resources out there on DBA admin.

    CREATE DATABASE foo;
    GRANT ALL PRIVILEGES ON foo.* TO "foo-dba"@"localhost" IDENTIFIED BY "foopassword";
    GRANT DELETE, INSERT, SELECT, UPDATE ON foo.* TO "foo"@"localhost" IDENTIFIED BY "anotherpassword";
    
    edited by asb
  • Thanks for your response!
    The website is self written so I didn't use Wordpress or anything. Is it possible to copy my existing database to the server or do I have to make the whole database all over again? (Because I don't really get what you mean by the commands) And do you have any proposals for a good tutorial or something to get started with this thing?

  • @bananacakeman - See this DO tutorial and look for the section "Backing Up", which also has the restoration commands.
    Another alternative is to use phpMyAdmin. As I recall, with phpMyAdmin you can do export/import.

    by Justin Ellingwood
    MySQL is a popular database management system that is often used to manage the data from websites and applications. This guide will demonstrate how to backup the data in your MySQL databases, using a number of different methods.
  • Thank you! I installed phpMyAdmin already so I'll check it out!

1 Answer

This question was answered by @sandidgec:

You can set up all your mySQL tables, etc.. via (terminal)/command line, and there's a couple GUI mySQL things out there. Here's a small example of command to create your database, after that it's a matter of the actual tables you need.. and so on. I know this leaves a lot to do.. but there's plenty of resources out there on DBA admin.

CREATE DATABASE foo;
GRANT ALL PRIVILEGES ON foo.* TO "foo-dba"@"localhost" IDENTIFIED BY "foopassword";
GRANT DELETE, INSERT, SELECT, UPDATE ON foo.* TO "foo"@"localhost" IDENTIFIED BY "anotherpassword";

View the original comment

Have another answer? Share your knowledge.