LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Setting up MySQL on VPS (https://www.linuxquestions.org/questions/linux-newbie-8/setting-up-mysql-on-vps-4175534870/)

RobInRockCity 02-23-2015 10:28 AM

Setting up MySQL on VPS
 
I am in the process of setting up my first VPS to host a website that I have been working on. By profession, I am a programmer, so I know nothing of Linux or web hosting!!

Thanks to lots of help on here this weekend, I finally learned how to access my VPS using SSH. (That only took a day or two to learn!) And my first command-line task was learning how to copy a file to another folder while maintaining the original modified date. (That only took another half-day!)

Whew! :)

So the next thing that I need to do is set up MySQL on my VPS...


My VPS runs on CentOS 6, and it also comes with cPanel, but since astrogeek and Miati were persistent in explaining why it is better to do things via the command-line versus using a GUI, I figured I would check things out...

My cPanel comes with some "wizard" that supposedly sets up a MySQL database for you, but whenever I see "wizard" I tend to run!

Advanced Support for my web host said that I should definitely use cPanel to create my database and create the users, because if I did it using phpMyAdmin it would supposedly mess things up as cPanel wouldn't recognize things?

(BTW, I requested MySQL Root access this morning, but I do not have Root access to my VPS - by choice for now!)


Questions:
1.) Should I listen to my web host and use the cPanel wizard to create a new MySQL database?


2.) If I decide to bypass cPanel, how exactly would I use my MacBook to talk to my VPS and do MySQL stuff over command-line?

FWIW, I developed my entire database using phpMyAdmin in MAMP on my MacBook. When I created my original database in development, I used phpMyAdmin's GUI. And then for everything else (e.g. create table, indexes, queries, etc.), I hand-wrote the SQL in TextEdit and then ran it in phpMyAdmin.

But I have no clue how to do any of this on my VPS!!


3.) How would I use the command-line to create a new database and set up groups and users for MySQL?


4.) If I did things by command-line, is it true that I would break cPanel?


I have been working on my website for the last 3 years, and it is ready to "go live", but I am discovering that setting up my VPS properly - and with lots of security - and getting things like PHP and MySQL set up is a very daunting task!!!

:(

Sincerely,


Rob

linuxtech99 02-23-2015 04:32 PM

cPanel is user friendly tools to manage your domain (creating mysql dbs, ftp accounts, email accounts, backing up dbs etc..). Once you get root access to your VPS, you can able to create the Databases manually. But you may not be able to see the manually created databases in cPanel GUI and I'm not sure if it is going to break the cPanel functionality.

Considering your Linux experience, I would recommend you to use cPanel to manage the databases. When you get used to cPanel and Linux shell commands, you can try creating Data bases manually (if you dont worry about cPanel :) ). And one thing, you can still restore the database you developed once you get root access to your VPS.
  • Create database through cPanel
  • copy your database to the VPS server
  • Using mysql command in your VPS server, restore the database

Command to restore myssql db

Code:

mysql db_name < /path to your DB backup.sql
mysql -u root -p <your mysql root password> < /path to your DB backup.sql


RobInRockCity 02-23-2015 07:30 PM

@linuxtech99,

So what additional functions does cPanel offer other than creating the database and users and assigning them?

In other words, if I created my database using command-line and therefore "broke" cPanel, what other database functions would I lose?


Rob

linuxtech99 02-23-2015 09:18 PM

All the functions of cPanel is listed in their website - http://cpanel.net/cpanel-whm/full-feature-list/.

Creating database manually doesn't really break the functionality of the cPanel. But, just you dont see the data base created in cPanel interface. May be your hosting provider can provide you more information on these.

RobInRockCity 02-23-2015 09:19 PM

Quote:

Originally Posted by linuxtech99 (Post 5322348)
All the functions of cPanel is listed in their website - http://cpanel.net/cpanel-whm/full-feature-list/.

Creating database manually doesn't really break the functionality of the cPanel. But, just you dont see the data base created in cPanel interface. May be your hosting provider can provide you more information on these.

Not being able to see my sole database in cPanel isn't really a bug deal to me.

But would it break things like being able to use cPanel to do backups? (I'm guessing, yes.)


Rob


All times are GMT -5. The time now is 04:33 AM.