MySQL on CentOS

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
j0rd0n420
This is my homepage
This is my homepage
Posts: 157
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Mon Jul 07, 2008 1:47 pm

MySQL on CentOS

Post by j0rd0n420 »

I need help getting MySQL on CentOS 5.5 so that I can run these two things:

http://www.minecraftforum.net/viewtopic ... 12&t=23340
http://minecraftforum.net/viewtopic.php?f=1013&t=44940

The hey0's mod read me says this:

If you wish to use mysql you will have to run the server once, open server.properties and set data-source to mysql.
Run it again, it'll error out. Don't worry. There should be a mysql.properties file now. Edit to your server, username, password, and db.
Don't forget to execute the included minecraft.sql file on your database.

Which assumes I know how to work MySQL :oops:
User avatar
Edge100x
Founder
Founder
Posts: 13127
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: MySQL on CentOS

Post by Edge100x »

It looks like you'd use commands like this to install a MySQL server on CentOS:

Code: Select all

yum install mysql-server mysql-server mysql-dev
/sbin/chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
After that, you would likely need to create a database through the MySQL client for Minecraft to use, along with a user for it. For instance, the window when doing this might look like:

Code: Select all

# mysql -p
Enter password: (enter your MySQL root password)
mysql> create database minecraft;
mysql> grant all privileges on minecraft.* to 'minecraft'@'localhost' identified by 'somepassword';
After this, it would be able to connect to the "minecraft" database at "localhost" with username "minecraft" and password "somepassword".
j0rd0n420
This is my homepage
This is my homepage
Posts: 157
Joined: Mon Jul 07, 2008 1:47 pm

Re: MySQL on CentOS

Post by j0rd0n420 »

Thanks, I'll give that a go.
j0rd0n420
This is my homepage
This is my homepage
Posts: 157
Joined: Mon Jul 07, 2008 1:47 pm

Re: MySQL on CentOS

Post by j0rd0n420 »

when I do: mysql -p in the terminal and enter my root pw I get this error:

Can't connect to local MySQl server throught socket '/var/lib/mysql/mysql.sock' (2)
j0rd0n420
This is my homepage
This is my homepage
Posts: 157
Joined: Mon Jul 07, 2008 1:47 pm

Re: MySQL on CentOS

Post by j0rd0n420 »

j0rd0n420 wrote:when I do: mysql -p in the terminal and enter my root pw I get this error:

ERROR 2002 (HY000): Can't connect to local MySQl server throught socket '/var/lib/mysql/mysql.sock' (2)
User avatar
Edge100x
Founder
Founder
Posts: 13127
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: MySQL on CentOS

Post by Edge100x »

This means that the MySQL server isn't running. What did your system respond with when you typed this earlier?

Code: Select all

/etc/init.d/mysqld start
j0rd0n420
This is my homepage
This is my homepage
Posts: 157
Joined: Mon Jul 07, 2008 1:47 pm

Re: MySQL on CentOS

Post by j0rd0n420 »

Edge100x wrote:This means that the MySQL server isn't running. What did your system respond with when you typed this earlier?

Code: Select all

/etc/init.d/mysqld start
I didn't type that before, a friend just had me do it, and i'm runing /usr/bin/mysql_secure_installation now, so I'm ok for now. thanks.
j0rd0n420
This is my homepage
This is my homepage
Posts: 157
Joined: Mon Jul 07, 2008 1:47 pm

Re: MySQL on CentOS

Post by j0rd0n420 »

I totally missed it in your first post like an idiot.
j0rd0n420
This is my homepage
This is my homepage
Posts: 157
Joined: Mon Jul 07, 2008 1:47 pm

Re: MySQL on CentOS

Post by j0rd0n420 »

I've tried following you and these two guides:
http://www.if-not-true-then-false.com/2 ... -hat-rhel/
http://www.techiecorner.com/125/how-to- ... using-yum/

but the php test never works :(
User avatar
Edge100x
Founder
Founder
Posts: 13127
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: MySQL on CentOS

Post by Edge100x »

Getting the whole LAMP stack on there is a little more complicated and something that I haven't done on CentOS personally. But, it looks like the basic part of it would be to install Apache and a special version of PHP that supports MySQL:

Code: Select all

yum install httpd php-mysql
You'll then need to start up the httpd service and put the PHP application inside your Apache document root.
j0rd0n420
This is my homepage
This is my homepage
Posts: 157
Joined: Mon Jul 07, 2008 1:47 pm

Re: MySQL on CentOS

Post by j0rd0n420 »

Could help me better if I switched to Gentoo? I'm just worried about installing minecraft and those two mods cause I've only found guides for CentOS for those.
User avatar
Edge100x
Founder
Founder
Posts: 13127
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: MySQL on CentOS

Post by Edge100x »

With Gentoo, I would be able to provide a bit more assistance, but it's also been awhile since I've set up a basic single-user install (we use something much more complicated here for our shared hosting).

What did it respond when you issued the commands to install the MySQL-enabled PHP and Apache that I mentioned above?
j0rd0n420
This is my homepage
This is my homepage
Posts: 157
Joined: Mon Jul 07, 2008 1:47 pm

Re: MySQL on CentOS

Post by j0rd0n420 »

I haven't tried it yet, going to try again after dinner.
j0rd0n420
This is my homepage
This is my homepage
Posts: 157
Joined: Mon Jul 07, 2008 1:47 pm

Re: MySQL on CentOS

Post by j0rd0n420 »

Following this guide: http://www.techiecorner.com/125/how-to- ... using-yum/

Everything goes fine till I test php, I just get a blank white page.
User avatar
Edge100x
Founder
Founder
Posts: 13127
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: MySQL on CentOS

Post by Edge100x »

Do regular pages work?

Does your PHP script have the right permissions (is it owned by the httpd user, and is it set to something like chmod 644)?

Are you testing with the simple phpinfo() script that it recommends?

What shows in your Apache error_log (likely /var/log/apache2/error_log)?
Post Reply