error with mysql when doing mysql -u root

Sunil Sunder Raj unixtools at hotmail.com
Mon Sep 22 20:56:31 PDT 2003


Hi,

Hi,

If you have set a root password, but forgot what it was, you can set a new 
password with the following procedure:

1) Take down the mysqld server by sending a kill (not kill -9) to the mysqld 
server. The pid is stored in a `.pid' file, which is normally in the MySQL 
database directory:

        shell> kill `cat /mysql-data-directory/hostname.pid`
        You must be either the Unix root user or the same user mysqld runs 
as to do this.

2) Restart mysqld with the --skip-grant-tables option.
3) Set a new password with the mysqladmin password command:

        shell> mysqladmin -u root password 'mynewpassword'

4) Now you can either stop mysqld and restart it normally, or just load the 
privilege tables with:

        shell> mysqladmin -h hostname flush-privileges

5) After this, you should be able to connect using the new password.

Alternatively, you can set the new password using the mysql client:

1) Take down and restart mysqld with the --skip-grant-tables option as 
described above.
2) Connect to the mysqld server with:

        shell> mysql -u root mysql

3) Issue the following commands in the mysql client:
        mysql> UPDATE user SET Password=PASSWORD('mynewpassword') WHERE 
User='root';
        mysql> FLUSH PRIVILEGES;

4) After this, you should be able to connect using the new password.
5) You can now stop mysqld and restart it normally.


Regards
SSR

Regards
SSR


>From: "Shawn Guillemette" <shawn at guillemette.org>
>To: "Kevin Kinsey" <kdk at daleco.biz>
>CC: questions at freebsd.org
>Subject: Re: error with mysql when doing mysql -u root
>Date: Sat, 20 Sep 2003 10:00:39 -0700
>
>like this ?
>
># mysql -u root -p password
>Enter password:
>ERROR 1045: Access denied for user: 'root at localhost' (Using password: YES)
>
>
>if so is there a way I can reset the "root"' passwd for mysql?
>I have tried mysqladmin -u root passowrd newpassword and get this
>
>
>
>Shawn
>
>
>----- Original Message -----
>From: "Kevin Kinsey" <kdk at daleco.biz>
>To: "Shawn Guillemette" <shawn at guillemette.org>
>Cc: <questions at freebsd.org>
>Sent: Saturday, September 20, 2003 6:42 AM
>Subject: Re: error with mysql when doing mysql -u root
>
>
> > On Sat, Sep 20, 2003 at 08:55:30AM -0700, Shawn Guillemette wrote:
> > > After setting the mysql root user passwd I get this when trying to log
>in.
> > >
> > > # mysql -u root
> > > ERROR 1045: Access denied for user: 'root at localhost' (Using password:
>NO)
> > >
> > > Just after the install of mysql I had created a database as a test
>successfully..
> > >
> > IIRC, it's: 'mysql -u root -p mypassword'
> >
> > HTH,
> >
> > Kevin Kinsey
> >
>
>_______________________________________________
>freebsd-questions at freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>To unsubscribe, send any mail to 
>"freebsd-questions-unsubscribe at freebsd.org"

_________________________________________________________________
A chance to meet Aishwarya Rai. http://www.myenjoyzone.com/msn/knk.php3 Win 
lucky prizes.



More information about the freebsd-questions mailing list