Be Excellent To Each Other

And, you know, party on. Dude.

All times are UTC [ DST ]




Reply to topic  [ 40 posts ] 
Author Message
 Post subject: MySQL x 2
PostPosted: Mon Jun 29, 2009 11:24 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
Hello!
I have the jolly task of trying to create a second database server on one of our production boxes, which already has a MySQL server running on it.
The second database will use a different socket and datafile to the first, and I'd rather not shut the existing database down if I can help it.

However, I'm drawing a blank. I've tried using mysqld_multi but it makes my head hurt (and didn't seem to work). I've also read this page but I'm still having no success. Does anyone have any advice?

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 11:27 
User avatar
Gogmagog

Joined: 30th Mar, 2008
Posts: 48910
Location: Cheshire
Grim... wrote:
Hello!
I have the jolly task of trying to create a second database server on one of our production boxes, which already has a MySQL server running on it.
The second database will use a different socket and datafile to the first, and I'd rather not shut the existing database down if I can help it.

However, I'm drawing a blank. I've tried using mysqld_multi but it makes my head hurt (and didn't seem to work). I've also read this page but I'm still having no success. Does anyone have any advice?


You'll need an old priest, and a young priest.

failing that, it's probably the index tables of the database sending looking for things in the wrong place. So fix that, first.

_________________
Mr Chris wrote:
MaliA isn't just the best thing on the internet - he's the best thing ever.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 11:34 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
It's not worth me hitting the "Display this post" link on that one, is it?

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 11:34 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Grim... wrote:
It's not worth me hitting the "Display this post" link on that one, is it?
Nope.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 11:36 
User avatar
UltraMod

Joined: 27th Mar, 2008
Posts: 55719
Location: California
Grim... wrote:
It's not worth me hitting the "Display this post" link on that one, is it?

Is it ever?

_________________
I am currently under construction.
Thank you for your patience.


Image


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 11:45 
User avatar

Joined: 30th Mar, 2008
Posts: 14375
Location: Shropshire, UK
Well, according to that page you can just pass a different socket to the new server when you invoke it through the shell, e.g. mysqld --socket=mysql2.sock or whatever.

Or is it the datafiles that're causing the problem?

You should be able to specify --datadir=xxx to specify different datafiles too.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 11:51 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
GazChap wrote:
Or is it the datafiles that're causing the problem?

Maybe - I thought it created them if they weren't there? Maybe that's where I'm going wrong.

Code:
Starting mysqld daemon with databases from /home/matt/sqltest
mysqld_safe[9698]: started
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[9703]: ended

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 11:54 
User avatar

Joined: 30th Mar, 2008
Posts: 14375
Location: Shropshire, UK
It should do, yeah. Can you have a gander in the directory and see if the files are there after the server's stopped?


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:00 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
Yeah, they're there. Here's the (unhelpful) log file:
Code:
/usr/sbin/mysqld, Version: 5.0.32-Debian_7etch8-log (Debian etch distribution). started with:
Tcp port: 3310  Unix socket: /var/run/mysqld/mysqld2.sock
Time                 Id Command    Argument

Bah.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:01 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
Aha, hang on. Now I'm getting somewhere - it's the socket that's at fault.
Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld2.sock' (2)

Do I have to create the socket myself? Again, I thought MySQL dealt with that.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:05 
User avatar

Joined: 30th Mar, 2008
Posts: 14375
Location: Shropshire, UK
Yeah, you can't create a socket manually, MySQL (or the host OS) should create it for you.

Permissions issue on /var/run/mysqld/, perhaps?


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:08 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
Nope - 0777 (this is a dev box, so no worries there).

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:11 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
Here are the important bits of the .cnf file that I'm telling it to run:
Code:
[client]
port            = 3310
socket          = /var/run/mysqld/mysqld2.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket          = /var/run/mysqld/mysqld2.sock
nice            = 0

[mysqld]
#
# * Basic Settings
#
user            = root
pid-file        = /var/run/mysqld/mysqld2.pid
socket          = /var/run/mysqld/mysqld2.sock
port            = 3310
basedir         = /usr
datadir         = /home/matt/sqltest
tmpdir          = /tmp
language        = /usr/share/mysql/english


You think I should change the basedir?

I'm shit at this stuff :(

/goes off to program something

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:11 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49244
The port is different to the original database, right?

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:14 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
Craster wrote:
The port is different to the original database, right?

Yeah, original uses 3306. Changing the basedir made no difference.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:16 
User avatar

Joined: 30th Mar, 2008
Posts: 14375
Location: Shropshire, UK
Isn't a software/hardware firewall of some sort blocking connections to 3310 is there?


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:17 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
GazChap wrote:
Isn't a software/hardware firewall of some sort blocking connections to 3310 is there?

Hmm, don't think so.
I'll check.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:19 
User avatar
UltraMod

Joined: 27th Mar, 2008
Posts: 55719
Location: California
Sounds stupid (probably is), but have you tried stopping and starting mysqld?

_________________
I am currently under construction.
Thank you for your patience.


Image


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:21 
User avatar

Joined: 30th Mar, 2008
Posts: 14375
Location: Shropshire, UK
Try this in the shell:
Code:
mysql_install_db --user=xxx --basedir=yyy --datadir=zzz

And then try starting the server.

I'd backup your existing datadir/basedir beforehand though, not sure if this is intelligent enough to not wipe out existing datafiles.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:22 
User avatar

Joined: 30th Mar, 2008
Posts: 14375
Location: Shropshire, UK
myp wrote:
Sounds stupid (probably is), but have you tried stopping and starting mysqld?

Grim... doesn't want to shut down the existing server if he can help it, I think.

Shutting down mysqld and restarting it would only affect the server currently running, may not have any effect on any new server(s) he wants to start up.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:28 
User avatar
UltraMod

Joined: 27th Mar, 2008
Posts: 55719
Location: California
Hrmmm, yes, I'd forgotten about that.

_________________
I am currently under construction.
Thank you for your patience.


Image


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 12:35 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
GazChap wrote:
Try this in the shell:
Code:
mysql_install_db --user=xxx --basedir=yyy --datadir=zzz

And then try starting the server.


Hmm, that spat out the error
Code:
090629 12:33:03 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/help_relation.frm' (errno: 13)
about 1,000 times but seemed to complete anyway.
But! No difference, as far as I can tell.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Mon Jun 29, 2009 13:48 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
Yay verbose output!
Code:
090629 13:47:06 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
090629 13:47:06 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
090629 13:47:06 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)

would seem to be the problem. Why the hell is it looking there for stuff? Ooh, basedir!

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Tue Jun 30, 2009 13:38 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
AND LO, THE CLOUDS DID PART, AND THE LIGHT DID COME SHINING DOWN, AND THE TERMINAL, IT SAID:

Attachment:
PRAISEBE.gif


AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!


You do not have the required permissions to view the files attached to this post.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Tue Jun 30, 2009 13:40 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49244
Hurrah! I think.

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Tue Jun 30, 2009 13:42 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
Code:
mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.01 sec)

Hurrah indeed.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Tue Jun 30, 2009 13:46 
User avatar
UltraMod

Joined: 27th Mar, 2008
Posts: 55719
Location: California
Kudos on your leet skillz, soldier.

_________________
I am currently under construction.
Thank you for your patience.


Image


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Tue Jun 30, 2009 14:06 
User avatar
Excellently Membered

Joined: 30th Mar, 2008
Posts: 1268
Location: Behind you!
So what was the problem in the end?


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Tue Jun 30, 2009 14:20 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
I have no fucking clue. It's actually a really simple thing to do - make a new config file and then just start MySQL with
Code:
/usr/bin/mysqld_safe  --defaults-file=/my/new/file.cnf

I think it was just the strange way it was installed onto the server in the first place that was fucking everything up.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Tue Jun 30, 2009 14:42 
User avatar

Joined: 30th Mar, 2008
Posts: 14375
Location: Shropshire, UK
No root password? Tut tut ;)

And do you have another server called hunky?


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Tue Jun 30, 2009 14:53 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
GazChap wrote:
No root password? Tut tut ;)

And do you have another server called hunky?

Afraid not. This one is called Dory because of its tendency to forget things :S
We have Hindenburg, Titanic and United93, though.
"Titanic's gone down again!"
Much joy :)

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Tue Jun 30, 2009 15:06 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49244
Fish actually have a decent memory - many are quite capable of being trained.

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Tue Jun 30, 2009 15:09 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
Craster wrote:
Fish actually have a decent memory - many are quite capable of being trained.

Yes indeed. But we didn't call it "fish".

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Thu Jan 07, 2010 17:21 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
Mind if I hijack this thread?

I was toying with the idea of converting some of my websites to WordPress. To do this I need to use MySQL. I've installed that.

Now what? I'm at a bit of a loss what to do with it - no idea how to address it from the command line, and got horribly confused with user names and so on when trying to run phpmysqladmin.

Can anyone give me some basic pointers to how to create a user, set up databases so that Wordpress can use it, and so on?


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Thu Jan 07, 2010 18:19 
User avatar

Joined: 30th Mar, 2008
Posts: 14375
Location: Shropshire, UK
Are you on Windows?


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Thu Jan 07, 2010 18:27 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
No, mac...


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Thu Jan 07, 2010 18:43 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
When you set it up, did you specify a root password?

If so, at the prompt:
Code:
mysql -uroot -p
Then type your password. This should get you to your MySQL command prompt.

Try typing
Code:
show databases;
to see if everything is working (note the semicolon).


If this works, install Wordpress following the instructions, and it'll create its own database once you tell it the username (root) and password.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Thu Jan 07, 2010 18:46 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69721
Location: Your Mum
Oh, you might need to start it first. Use
Code:
/etc/init.d/mysqld start
at the prompt.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Fri Jan 08, 2010 0:13 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
Woo, awesome, thanks Grim...
I know it's running, there's a thinger in the control panel for that.

I think there is no password on the root.. user.

Code:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.18 sec)


The WP setup is asking for

Database Name The name of the database you want to run WP in.
User Name Your MySQL username
Password ...and MySQL password.
Database Host 99% chance you won't need to change this value.
Table Prefix

So I need to make those first, right? OK, it actually has instructions for doing it from the command line, I missed that last time.

To be continued...


Top
 Profile  
 
 Post subject: Re: MySQL x 2
PostPosted: Fri Jan 08, 2010 0:33 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
Oh, that was easy. Why did nobody say wordpress was so handy?


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 40 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Columbo, The Greys and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search within this thread:
You are using the 'Ted' forum. Bill doesn't really exist any more. Bogus!
Want to help out with the hosting / advertising costs? That's very nice of you.
Are you on a mobile phone? Try http://beex.co.uk/m/
RIP, Owen. RIP, MrC. RIP, Dimmers.

Powered by a very Grim... version of phpBB © 2000, 2002, 2005, 2007 phpBB Group.