Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am a little confused with setting up my new MySql server. It has to be a standalone server. Other webservers should connect to it.

The hostname of the webserver is "webserver", the IP is 192.168.1.50, and it's working

The hostname of the mysql server is "mysql", the IP is 192.168.1.60, and it's working

I like to use a hostname instead of IP address to connect to the mysql server.

In /etc/hosts (mysql server) I have:

127.0.0.1     localhost
192.168.1.50  webserver 

The webserver has no virtual hosts, there is one big directory /var/www that contains several websites in development.

I have used this as a guide: http://library.linode.com/databases/mysql/standalone-mysql-server

On service mysql start:

start: Rejected send message, 1 matched rules; type="method_call", 
sender=":1.8" (uid=1000 pid=5060 comm="start mysql ") 
interface="com.ubuntu.Upstart0_6.Job" member="Start" 
error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" 
(uid=0 pid=1 comm="/sbin/init")

Log entries

120421 16:10:31  InnoDB: Starting shutdown...
120421 16:10:36  InnoDB: Shutdown completed; log sequence number 0 44233
120421 16:10:36 [Note] /usr/sbin/mysqld: Shutdown complete

120421 16:14:04 [Note] Plugin 'FEDERATED' is disabled.
120421 16:14:04  InnoDB: Initializing buffer pool, size = 8.0M
120421 16:14:04  InnoDB: Completed initialization of buffer pool
120421 16:14:04  InnoDB: Started; log sequence number 0 44233
120421 16:14:04 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
120421 16:14:04 [ERROR] Do you already have another mysqld server running on port: 3306 ?
120421 16:14:04 [ERROR] Aborting
share|improve this question
    
What is the issue you're trying to solve? What is your question? –  jippie Apr 21 '12 at 13:52
    
How do I get it working as a standalone Mysql server? What corrections do I have to make in de Ubuntu /etc/hosts file so that the websites on the webserver can connect to "mysql"? –  Klaaz Apr 21 '12 at 13:55
    
sudo netstat -antp | grep -i mysql What is the output on the mysql server? –  jippie Apr 21 '12 at 14:04
    
nothing (empty) –  Klaaz Apr 21 '12 at 14:07
    
mysql is not running. What is the output if you run sudo /etc/init.d/mysql start –  jippie Apr 21 '12 at 14:10
show 2 more comments

2 Answers

Old question, but I'm going to answer it since I had the same problem today and found a solution.

Short answer is you need to complete the static IP guide from here: http://library.linode.com/networking/configuring-static-ip-interfaces

Since it looks like you are using Linode and private IP addresses, my answer is going to be tailored to that environment.

I'm actually using CentOS, so haven't tried these instructions on Ubuntu, but the CentOS instructions were accurate, so here they are for Ubuntu/Debian

First, change /etc/network/interfaces to be

 # The loopback interface auto lo iface lo inet loopback

 # Configuration for eth0 and aliases

 # This line ensures that the interface will be brought up during boot. 
 auto eth0 eth0:0 eth0:1

 # eth0 - This is the main IP address that will be used for most outbound connections.
 # The address, netmask and gateway are all necessary. 
 iface eth0 inet static
  address 12.34.56.78
  netmask 255.255.255.0
  gateway 12.34.56.1

 # eth0:0
 # This is a second public IP address.
 iface eth0:0 inet static
  address 34.56.78.90
  netmask 255.255.255.0

 # eth0:1 - Private IPs have no gateway (they are not publicly routable)
 # so all you need to specify is the address and netmask. 
iface eth0:1 inet static
  address 192.168.133.234
  netmask 255.255.128.0

Note - these addresses are straight off the Linode example config - change the eth0:1 IP to be your private IP address as given by your Linode configuration page. Also change the eth0 IP to be your main IP address as assigned by Linode.

As root at the command prompt, enter /etc/init.d/networking restart

And that's it - it should work now as you expected.

The page linked above also provides instructions for Fedora/CentOS, Arch, Gentoo, and OpenSuse.

EDIT: I found that I had to update my DNS resolver settings as well.

Edit /etc/resolv.conf

# Generated by NetworkManager
domain linode.com
search linode.com
nameserver <your-nameserver-here>
nameserver <your-other-nameserver-here>
options rotate

Note that the domain and search values are optional and are different in my file than what Linode suggests in their examples. This is how my file was by default and I left it that way - just needed to delete an inaccurate nameserver and add the 2 nameservers from my Linode server Remote Access page. Also added was the options rotate line.

Linode also recommends uninstalling DHCP, which seems unnecessary to me. If you'd like to, the command is apt-get remove isc-dhcp-client dhcp3-client dhcpcd

share|improve this answer
    
Answers for Fedora or CentOS should not necessarily be used just for Ubuntu or Debian. They do have separate configurations. –  Thomas W. Aug 1 '12 at 17:07
    
I see what you are saying now - changed instructions to be appropriate for Ubuntu/Debian –  TheLastCicada Aug 3 '12 at 22:31
add comment

add 192.168.1.60 mysql in /etc/hosts of all servers that should connect to mysql....

share|improve this answer
    
I did. Necessary I think, but did not solve it yet. –  Klaaz Apr 21 '12 at 14:16
1  
Sorry, missed the point of your question. try telnet mysql 3306 and see if you get a connection, that would mean some service is using that port already. –  Ruediger Apr 21 '12 at 15:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.