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


Similar Content



Execute Script On Mysql Exit

Hello,

In debian I created a new user "myUser".

In /home/myUser/.profile

I added "mysql -u user -password"

So automatically after login to linux terminal the user is logged in mysql command line.

What I need to do is to exit terminal after user exit mysql, so he want have access to comand line.

Mysql Is Not Working In Php On Centos

I have installed httpd, mysql, php on a centos machine. Php executes in the browser of my machines website, mysql can be ran from the command line, but mysql within php in a browser will not work.
I know my code is syntactically correct since it will run on another Centos Lamp machine and NetBeans says it is.
My code
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="300">
<title> Freeze Warn Points table Query"</title>
</head>
<body>
<?php
include("config.php");
echo $dbhost;
echo "<br />\n";
echo $dbuser;
echo "<br />\n";
echo $dbpasswd;
echo "<br />\n";
mysql_connect($dbhost, $dbuser, $dbpasswd) or die("Unable to connect to database");
echo 'Connected Successfully';
mysql_select_db($dbname);

echo "zone"."&nbsp;&nbsp;&nbsp;&nbsp;";
echo "currentLow"."&nbsp;&nbsp;&nbsp;"."dateLastRep"."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "priority"."&nbsp;&nbsp;&nbsp;"."siteId"."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp"."siteName";
echo "<br />\n";

$result = $sql = 'SELECT zone, currentLow, dateLastRep, pri, siteId, siteName from points order by zone, pri';
$numRows = mysql_num_rows($result);
echo "Matches: ".mysql_num_rows($result);
for($a=0; $a<$numRows; $a++)
{ $rowArray = mysql_fetch_row($result);
echo $rowArray[0]." ".$rowArray[1]." ".$rowArray[2]." ".$rowArray[3]." ".$rowArray[4]."&nbsp;&nbsp;&nbsp".$rowArray[5]."<br />";
}
mysql_close();
?>
</body>
</html>


When executed on the CENTOS lamp machine in question out puts this

"; $result=mysql_query("SELECT rpad(zone,6,'-'), rpad(currentLow,13,'-'), rpad(dateLastRep,13,'-'), rpad(pri,8,'-'), rpad(siteId,6,'-'), siteName from points order by zone, pri"); $numRows = mysql_num_rows($result); for($a=0; $a<$numRows; $a++) { $rowArray = mysql_fetch_row($result); echo $rowArray[0]." ".$rowArray[1]." ".$rowArray[2]." ".$rowArray[3]." ".$rowArray[4]." ".$rowArray[5]."
"; } mysql_close(); ?>


When I put the same code in the other machine, (it does not have the mysql database so it will not connect) displays this

204.227.112.31
apache
password
Unable to connect to database

httpd is running of course
mysqld is running
I have
mysql-server-5.1.73-3.el6_5.x86_64
php-mysql-5.3.3-40.el6_6.x86_64
mysql-devel-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
mysql-5.1.73-3.el6_5.x86_64
php-mbstring-5.3.3-40.el6_6.x86_64
php-odbc-5.3.3-40.el6_6.x86_64
php-imap-5.3.3-40.el6_6.x86_64
php-mysql-5.3.3-40.el6_6.x86_64
php-xml-5.3.3-40.el6_6.x86_64
phpmyadmin-2.11.11.3-2.el6.rf.noarch
php-cli-5.3.3-40.el6_6.x86_64
php-xmlrpc-5.3.3-40.el6_6.x86_64
php-gd-5.3.3-40.el6_6.x86_64
php-5.3.3-40.el6_6.x86_64
php-pdo-5.3.3-40.el6_6.x86_64
php-common-5.3.3-40.el6_6.x86_64
php-ldap-5.3.3-40.el6_6.x86_64
php-pear-1.9.4-4.el6.noarch

Installed.

I checked the php.ini files and the httpd.conf files with the LAMP machine it works on and have been unable to find any discrepancies.
Unless I missed something.

Selinux is disabled.

I know it is not my code, but some type of setting somewhere on my machine, I have not been able to find.
I have been unable to find any thing like this issue.

Thanks,
Nancy

Trouble Installing Mysql

Hi everyone,
i tried to install mysql on my slackware 14.1.
typed mysql_install_db --user=mysql and went to the automatic configuration of secure access and receive this "Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)".
How can remove this installation, to try to reinstall the db?


And another error when try to reinstall :
"bash-4.2# mysql_install_db --user=mysql
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
150130 9:40:11 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13)
150130 9:40:11 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
150130 9:40:11 [ERROR] Plugin 'Aria' init function returned error.
150130 9:40:11 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
150130 9:40:11 [ERROR] mysqld: Can't find file: './mysql/db.frm' (errno: 13)
ERROR: 1017 Can't find file: './mysql/db.frm' (errno: 13)
150130 9:40:11 [ERROR] Aborting

150130 9:40:11 [Note] /usr/libexec/mysqld: Shutdown complete


Installation of system tables failed! Examine the logs in
/var/lib/mysql for more information.

The problem could be conflicting information in an external
my.cnf files. You can ignore these by doing:

shell> /scripts/mysql_install_db --defaults-file=~/.my.cnf

You can also try to start the mysqld daemon with:

shell> /usr/libexec/mysqld --skip-grant --general-log &

and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:

shell> /usr/bin/mysql -u root mysql
mysql> show tables

Try 'mysqld --help' if you have problems with paths. Using
--general-log gives you a log in /var/lib/mysql that may be helpful.

The latest information about mysql_install_db is available at
http://kb.askmonty.org/v/installing-...sql_install_db.
MariaDB is hosted on launchpad; You can find the latest source and
email lists at http://launchpad.net/maria

Please check all of the above before mailing us! And remember, if
you do mail us, you should use the /usr/bin/mysqlbug script!
bash-4.2#
"

About Mysql Show Processlist

I have connected to mysql console by "mysql -uroot -p" , then use the command "show processlist ;" to list the processes , but I can't see the result , may be the command is too long , the column only allow around 85 characters , the command should over the limit , how can I see the full command ?

thanks

Cant Connect To Mysql

Oh

Now I cannot connect to mysql on RHEL

I try:mysql --user=myuser--password=mydbpass mysql

and i get:

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

Sorry I have done this many times before but cannot get in on this server. If I
mysqladmin -u root -p status, it states:

Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

Cheers and sorry

PS /var/lib/mysql does not exist on my box

Which Database For PERL On Linux And WIndows?

I'm writing this program for my own edification. I want to write and retrieve from a database. I will start on Linux and probably use MySql. After I get the program working on Linux I would like to be able to use it on a Windows 7 or 8 platform. Here are some sample entries I would like to write to and draw from. Which database would you use? Does MySql work on both Linux and Windows?

Casino Date Buy-in time-at-table exit-monies
Binions 05/05/2015 200 3.5 -400
Wynns 05/06/2015 200 5.0 +400

Trip Total -200

Thank you;

Sherman

About The Cpanel

I just checked the function of cpanel , it is quite powerful , but I am not sure if cpanel suits for my work.

I am working in a small web hosting company , there are 4 linux web server ( LAMP ) with about 80 domain , mail system is iredmail , would advise cpanel help me for administration task , is it suitable for my situation ? thanks

Problem With (instalation Of?) Mysql.h On C

Hi, I've just recently installed MySQL connector/c from source code on my Slackware 14.1 x64

I read the official instructions of the connector but I felt a bit disorientated when I read:
Code:
1 -Change location to the top-level directory of the source distribution.

I interpreted that I have to go to the "highest" directory Code:
/

So I wrote: Code:
 
        #                            cd /

root@- /#                            tar xzvf /home/normal/Downloads/mysql-connector-c-6.1.6-src.tar.gz 

root@- /#                            cd /mysql-connector-c-6.1.6-src/

root@- /mysql-connector-c-6.1.6-src# cmake -G "Unix Makefiles"

root@- /mysql-connector-c-6.1.6-src# make 

root@- /mysql-connector-c-6.1.6-src# make install

Then I did:
Code:
ln -s /usr/local/mysql-5.6.25/include /usr/include

But when I try to compile a program in c with #include <mysql.h> i get this error:
Code:
# gcc ctemp.c 
In file included from ctemp.c:2:0:
/usr/include/mysql.h:57:27: fatal error: mysql_version.h: No such file or directory
 #include "mysql_version.h"
                           ^

What can I do? Thanks a lot and sorry for poor english

PD: If you need the official instructions I paste here the link: https://dev.mysql.com/doc/connector-...on-source.html

Command To Get Version Of Any Database Installed

mysqladmin -u root -p version

this is the command used to get version of MySql database.
similarly how can i get the details of any database installed??

Timeout Error Occurred Trying To Start Mysql Daemon

Hey guys,

I have fedora version 8 with mysql 5.0.45 istalled. I have also installed drupal. Recently drupal gave me an error "error code 28". When i checked it out it seemed to be with the db. When i tried to created a db (for testing puposes) in root...i wasnt able to. so then i tried to restart mysql ...it stopped but unfortunately i have not been able to get mysql back up...i get a messeage saying
"Timeout error occurred trying to start MySql Daemon"

Could you please assist...

Thanks in advance,