# mysql problems!!!!!!!

## timvor

hi all , been following the virtual mailhosting guide but got stuck with the mysql install.

done the following

# emerge mysql

# ebuild /var/db/pkg/dev-db/mysql-4.0.13-r3/mysql-4.0.13-r3.ebuild config

#cd /var/lib/mysql

#chown -R mysql:root mysql

#/usr/bin/mysql_install_db

which completed succesfully and started fine

1st problem 

/usr/bin/mysqladmin -u root -h mymachine password pass

fails with 'Host mymachine.mydomain.com is not allowed to connect to this mysql server

this has never worked , but perhaps i had different error 1st time

2nd problem

/usr/bin/mysqladmin -u root password pass

This accepted once only

# /etc/init.d/mysql start

# mysqladmin -u root -p create mailsql

# mysql -u root -p mailsql < genericmailsql.sql

# mysql -u root -p mysql

mysql> GRANT SELECT,INSERT,UPDATE,DELETE

	->     ON mailsql.*

	->     TO mailsql@localhost

	->     IDENTIFIED BY '$password';

	->     quit

from now on i cant get any thing except 

Enter password:

/usr/bin/mysqladmin: connect to localhost failed

error "\'access denied for user: root@localhost Using password yes

how do i undo this mess to a clean state to try this again, or reset the password, as it seems the password i am entering is not correct

I have solved just about every other problem I experienced by searching the forums so thanks to all who contribute

 :Smile: 

----------

## mglauche

the brute force method: remove everything in /var/lib/mysql/mysql/, and rerun the config script (mysql_install_db) - but beware, this might serious break existing mysql data ! so only use it on new installations  :Smile: 

----------

## timvor

 :Sad: 

am trying that now , thanks

----------

## elliotte

I am having similar problems after my first mysql install. Did your fix work?

----------

## dain-bramage

Having same problem here, anyone know how to fix this?

----------

## mterlouw

I had the same problem. The guide isn't so great about holding your hand at every step it seems. When you first run mysql_install_db, it generates the following output:

```
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

This is done with:

/etc/init.d/mysql start (you have to start the server first!)

/usr/bin/mysqladmin -u root -h *hostname* password 'new-password'

/usr/bin/mysqladmin -u root password 'new-password'

See the manual for more instructions.
```

Enter your own hostname where it says *hostname*. Also I'm assuming you place the password in the single quotes where it says 'new-password'. I guess I'll try and see what happens.

Maybe the guide should tell you that you need to set the password using those commands because it's easy to miss.

----------

## mterlouw

Ok, I just tried it and it appears to have worked. Just type those two commands from the last post to set the password. I don't know if they both are needed, but I did them both just in case. I had to add -p for the second command because after the first command the root password was in effect.

Also, when doing this step:

```
# mysql -u root -p mysql

mysql> GRANT SELECT,INSERT,UPDATE,DELETE

   ->     ON mailsql.*

   ->     TO mailsql@localhost

   ->     IDENTIFIED BY '$password';

   ->     quit
```

...substitute whatever you want the mysql password to be for $password.

----------

## sputicus

Thanks, the substitution for '$password' was the hint I needed to get out of this exact same problem. 

Not being a mysql expert, I assumed that '$password' meant something to the mysql engine. The assumption that the reader would understand the "put your password here" subtext mislead me for at least an hour.

----------

## amigabill

I'm havnig problems with this as well. 

```
bash-2.05b# mysql_install_db

Preparing db table

Preparing host table

Preparing user table

Preparing func table

Preparing tables_priv table

Preparing columns_priv table

Installing all prepared tables

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/etc/init.d/mysql start (you have to start the server first!)

/usr/bin/mysqladmin -u root -h tivo password 'new-password'

/usr/bin/mysqladmin -u root password 'new-password'

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at https://order.mysql.com

```

Seems to look OK. The first command there, "/etc/init.d/mysql start" seems to work OK.But the next one, "/usr/bin/mysqladmin -u root -h tivo password 'new-password'" doesn't play nicely:

```

bash-2.05b# /usr/bin/mysqladmin -u root -h tivo password mynewpasswd

/usr/bin/mysqladmin: connect to server at 'tivo' failed

error: 'Lost connection to MySQL server during query'

```

When I'm told "/etc/init.d/mysql start (you have to start the server first!)", is that part in parentheses telling me to start the server before I run that command, or does this command actually do the server starting?? What else might be going wrong here?? I've got my hostname working

```
bash-2.05b# hostname

tivo

```

and I've got a static IP address working. I did make up a domain name that doesn't necessarily exist. Should I take my cablemodem domain instead? Or jost not have a domainname?

Or does something else need done, another emerge package, or something? My ultimate goal is to get mythtv running...

----------

## sklettke

 *amigabill wrote:*   

> I've got a static IP address working. I did make up a domain name that doesn't necessarily exist. Should I take my cablemodem domain instead? Or jost not have a domainname?
> 
> Or does something else need done, another emerge package, or something? My ultimate goal is to get mythtv running...

 

Anyone have any suggestions yet regarding this? I'm having exactly the same problem.

Thanks.

Scott

----------

## bocacorazon

I also have a domain name that doesn't exist...

It does not recognize the (local) host.

Should I create an entry on the /etc/hosts file with the machine's address?

I would not like to do that since it gets the address via DHCP

----------

## Mr_Maniac

Hmm.. Try to add the user with:

 *Quote:*   

> GRANT (What to grant) ON (DATABASE) TO (user)@'%' IDENTIFIED BY (password);

 

This allows access for (user) from ANY machine!

Or you can try the REAL hostname of your machine (not localhost)...

----------

## Herring42

https://forums.gentoo.org/viewtopic.php?p=1314755#1314755

Basically:

Ensure that bind-address is commented out in /etc/mysql/my.cnf.

MySql is compiled without Tcp Wrappers support.

----------

