# mysql configuration

## p2cd3

I have follower along the MySQL Startup Guide - emerged OK, did: ebuild /var/db/pkg/dev-db/mysql-4.1.14-r1/mysql-4.1.14-r1.ebuild config

Binabik bin # /etc/init.d/mysql start

 * WARNING:  "mysql" has already been started. 

Next step is:

Binabik bin # /usr/bin/mysqladmin -u root -h Binabik password 'new-password'

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

error: 'Access denied for user 'root'@'localhost' (using password: NO)'

I can do this & mysql starts:

mysql -u root -h localhost -p

Also:

mysql -u jack -h localhost -p

works

BUT I cannot get "/usr/bin/mysqladmin -u root -h Binabik password 'new password' "to work as I am trying to setup Beancounter, it says I need user jack to config this - I allready have jack as a user in mysql

----------

## kashani

because Mysql is bound to localhost by default and not to your hostname which is probably pointed to the IP on eth0. So either use localhost to connect to Mysql which is fine especially if no on eever needs to connect to Mysql remotely or enable Mysql on all IP's by removing the bind-address line in /etc/mysql/my.conf file and restarting. 

kashani

----------

## p2cd3

kashani, I do not have a problem to start mysql as root or as jack

"mysql -u jack -h localhost -p"  will open mysql

My problem is I cannot :

Binabik ~ # /usr/bin/mysqladmin -u root -h localhost password 'new password'

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

error: 'Access denied for user 'root'@'localhost' (using password: NO)'

This is what I am trying to open "mysqlsdmin"

----------

## think4urs11

 *p2cd3 wrote:*   

> My problem is I cannot :
> 
> Binabik ~ # /usr/bin/mysqladmin -u root -h localhost password 'new password'
> 
> /usr/bin/mysqladmin: connect to server at 'localhost' failed

 

Pointing at the obvious... shouldn't it be /usr/bin/mysqladmin -u root -h localhost --password 'new password'

----------

## p2cd3

This is the result:

Binabik ~ #  /usr/bin/mysqladmin -u root -h localhost --password 'new password'

Enter password:

/usr/bin/mysqladmin: Unknown command: 'new password'

----------

## wizard69

 *Quote:*   

> Binabik ~ # /usr/bin/mysqladmin -u root -h localhost --password 'new password'
> 
> Enter password:
> 
> /usr/bin/mysqladmin: Unknown command: 'new password'

 

the correct command is mysqladmin -u root -h localhost password 'new password'

then login with

mysql -u root -p (mysql wll prompt for your password) or

mysql -u root -h localhost -p

----------

## DaveArb

 *p2cd3 wrote:*   

> Binabik bin # /usr/bin/mysqladmin -u root -h Binabik password 'new-password'
> 
> /usr/bin/mysqladmin: connect to server at 'Binabik' failed
> 
> error: 'Access denied for user 'root'@'localhost' (using password: NO)'

 

/usr/bin/mysqladmin -u root -p -h Binabik  password 'new-password'

Enter password: <enter root@localhost's password>

Dave

----------

## p2cd3

This is the result:

Binabik ~ # /usr/bin/mysqladmin -u root -p -h Binabik Snowlock Snowlock

Enter password:

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

error: 'Access denied for user 'root'@'localhost' (using password: YES)'

----------

## p2cd3

wizard69, I do not have a problem with accessing mysql, it is working, my problem is I cannot :

Binabik bin # /usr/bin/mysqladmin -u root -h Binabik password 'new-password' 

I need this to make jack a user so I can get Beancounter to accept jack as a user

What is confusing me is that I have jack as a user & can open mysql with:

mysql -u jack -h localhost -p

----------

## Corax

IIRC, there must not be any spaces between --password and 'new-password'.

----------

## DaveArb

 *p2cd3 wrote:*   

> Binabik ~ # /usr/bin/mysqladmin -u root -p -h Binabik Snowlock Snowlock

 

That doesn't match the pattern...

/usr/bin/mysqladmin -u root -p -h Binabik password 'Snowlock'

It works on a machine I just tested it with. YMMV.

Dave

----------

## p2cd3

DaveArb, it accepted that entry

This is the problem, when I try to open Beancounter this happens:

jack@Binabik ~ $ setup_beancounter -m

Now using MySQL

*** Error: No mysql user 'jack'

We were unable to start mysql as the user 'jack' does not exist

You need to create a MySQL user 'jack' first:

    Change to super user (MySQL Admin):   $ su -

    Start mysql program with mysql db:    # mysql mysql

    Create the user:       grant all privileges on *.* to jack@localhost;

    Exit from user mysql:                 > \q

    Exit from super user:                 # exit

and then run this script again.

[ NB These instructions are currently approximative. Consult your manual. ]

[    And email me a better version  :Smile:  ]

This is what happehs when I do the above:

mysql> grant all privileges on *.* to jack@localhost;

Query OK, 0 rows affected (0.00 sec)

mysql>                                                     

This tells me I have jack as a user, but, when I try to setup-beancounter it gives me the same message as above:

"*** Error: No mysql user 'jack'"

----------

## Bad Penguin

 *DaveArb wrote:*   

>  *p2cd3 wrote:*   Binabik ~ # /usr/bin/mysqladmin -u root -p -h Binabik Snowlock Snowlock 
> 
> That doesn't match the pattern...
> 
> /usr/bin/mysqladmin -u root -p -h Binabik password 'Snowlock'
> ...

 

You already have a root password set in the database, so you have to provide one to mysqladmin.

```
mysqladmin -u root -p -h localhost password 'your_new_password'
```

Give the current password (not the new one) when prompted the first time.

If that does not work, edit my.cnf, add skip-grant-tables, restart mysql, manually change your password, edit my.cnf and remove skip-grant-tables, restart mysql....

----------

## p2cd3

I did:

mysqladmin -u root -p -h localhost password 'your_new_password'

Binabik ~ # mysqladmin -u root -p -h localhost password 'gentoo'

Enter password:

mysqladmin: connect to server at 'localhost' failed

error: 'Access denied for user 'root'@'localhost' (using password: YES)'

using new password, now I cannot access 

mysql -u root -h localhost -p

can still access 

mysql -u jack -h localhost -p

Where in my.cnf do I manually change the paswd for root?

----------

## Bad Penguin

 *p2cd3 wrote:*   

> Where in my.cnf do I manually change the paswd for root?

 

I provided instructions in the post above...

Edit /etc/mysql/my.cnf and add or uncomment "skip-grant-tables".  This will allow mysql to bypass any authentication whatsoever, so make sure nobody else can access your database while you are doing this!

```
skip-grant-tables
```

Stop/start mysql:

```
/etc/init.d/mysql stop

/etc/init.d/mysql start

```

Enter mysql and reset the password:

```

# mysql -u root -h localhost mysql

mysql> update user set password = password('your_new_root_password') where user='root';

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> quit

```

Edit /etc/mysql/my.cnf, remove skip-grant-tables.

Restart mysql.

----------

## p2cd3

Bad Penguin, thanks very much, I now have root & jack back with the proper passwords[/topic]

----------

## Bad Penguin

 *p2cd3 wrote:*   

> Bad Penguin, thanks very much, I now have root & jack back with the proper passwords[/topic]

 

That skip-grant-tables option is handy for development, but don't forget to turn it back off  :Wink: 

----------

## netjunkie

I have my DB working ok, and can connect to it from localhost.

How do I allow foreign hosts to connect to it, for example my PC running Mysql Administrator.

I get error 1045, unable to connect.

I have networking as follows:

my.cnf

 *Quote:*   

> 
> 
> bind-address                            = 127.0.0.1
> 
> bind-address                            = 192.168.1.15
> ...

 

Myqlaccess.conf

 *Quote:*   

> 
> 
> # ----------------#
> 
> # Global settings #
> ...

 

----------

