Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've got a mysql server running on ubuntu virtual server.
I want to access the database from my host computer. (I can already access a web site from the host, so I know there's a connection between the 2).

I have only changes one thing about the config file. The IP address. I've changed it to 127.0.1.1 this is the same address I use to view the server web pages from my host.

I'm having 2 problems.

The first
I can't connect to the mysql server from the host computer.

The second.
When I access my server terminal, I can enter $mysql -u mysql and I'm given the mysql prompt.
From there, i can view the default tables "test" and "information_schema". I can even create tables on the database "test"
but when I try to create a user or create a database i get the following error.
1044 access denied for user ''@'localhost'
I don't know why it thinks my user is ''.
I'm logged in to the server as my user account. and then i logged into mysql server as "mysql" (which was just what it was set to in the config file. Also, if i try to use mysqladmin I get told i need SUPER privs. how do i set these up? Any ideas why this isn't working?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

The virtual machine running MySQL has it's own IP address and it is this you have to use to get access to MySQL from the host.

There are two things that may get in the way.

Firstly, check the MySQL settings - you need to enable access from the external IP address not just on 127.0.0.1 (which is only internal to the VM). AND you need to make sure that whatever MySQL user you are using has the rights to access the server from the host's IP address - access rights in MySQL are limited to specific source IP addresses - though you can use the % wildcard to allow from anywhere.

Secondly, make sure that Ubuntu's iptables firewall is not blocking inbound access to the MySQL port (3306 by default).

As for your other problems. It is likely that the MySQL user mysql does not have full admin rights and so is not allowed to create new databases. Change the MySQL root user (and note that these are NOT Linux users, they are MySQL users, something completely different) so that it has a password then try creating a database after logging into MySQL as root.

Note that you generally don't want the MySQL root user to be usable from outside the local machine - though it is fine for test servers.

share|improve this answer
    
Thanks for the tips. I've made sure the IP in the mysql.cnf is accurate. And I've made sure that my host OS can access the IP and Ports required. The big problem to me is that i get 1044 access denied for user ''@'localhost' I don't get why it thinks I am logged in as a nameless @ local host. –  Frantumn Jul 13 '12 at 15:22
    
Are the grant tables correctly initialised? If they are, you will have a file called user.MYD in the mysql database folder. If you haven't, you need to initialise the grant tables by running mysql_install_db which is a script that ships with MySQL. –  Julian Knight Jul 14 '12 at 17:03
    
I have to be honest and admit that I generally use either phpMyAdmin or webmin to do this stuff as I find it much easier. Though I realise you might not want the overheads. –  Julian Knight Jul 14 '12 at 17:05
    
Thanks Julian. i'll try that tonight. –  Frantumn Jul 16 '12 at 13:28
    
@brian: thanks for the edit! –  Julian Knight Jul 17 '12 at 11:45
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.