Hi

I have not installed mysql on my own, its the default one that is coming with fedora14 at /usr/local/mysql

I am giving you some screenshots, please check if you can find out something.
*********************************************************************************************************************************************************


The first issue is while I login using command
mysql -u root -p
it asks for password I enter, root123
then gives the error
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


let me give you the full flow:

I am using fedora 14
_________________________________________________________________________________________________________
in root I fire the below commands:
[starting the mysql]

[root@chandan init.d]# /etc/init.d/mysqld start
Starting mysqld: [ OK ]

now from my local account I try to login to sql,

[chadan@chandan ~]$ mysql -u root -p
Enter password:

[i give password as root123

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

But when I login using command

[chadan@chandan ~]$ mysql

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.51 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

[here I am able to login to server but when I try to create database then it gives error]

mysql> create database dummy;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'dummy'

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+

**********************************************************************************************************************************

NOW THE SECOND ISSUE WHEN I START THE SERVER IN DIFFERENT WAY.

[root@chandan init.d]# mysqld_safe --skip-grant-tables &

[1] 29006
[root@chandan init.d]# 110219 18:33:25 mysqld_safe Logging to '/var/log/mysqld.log'.
110219 18:33:25 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

Now from my account I try to login

[chadan@chandan ~]$ mysql -u root -p

Enter password: fsklfjfljf
here whatever password I give I am able to login

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.51 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)

now when I check mysql database
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed


mysql> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
23 rows in set (0.01 sec)

mysql> select host,user,password,Insert_priv,update_priv from user;
+---------------------- +------+---------- +-------------+-------------+
| host | user | password | Insert_priv | update_priv |
+---------------------- +------+---------- +-------------+-------------+
| localhost | root | root123 | Y | Y |
| username.corp.org.in | root | root123 | Y | Y |
| 127.0.0.1 | root | root123 | Y | Y |
| localhost | | | N | N |
| username.corp.org.in | | N | N |
+----------------------+------+----------+-------------+-------------+
5 rows in set (0.00 sec)

[here you can see that the password for root user is root123,
now here if i try to create database i am able to do that

mysql> create database dummy;


mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| dummy |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)

I dont know how to solve this also I tried to create another user but it denied

mysql> CREATE USER 'seen' IDENTIFIED BY 'seen123';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

I am not sure how you are setting the password but I think the problem is that you are not encrypting it when you do. When I select user, host, password from mysql it shows like this:

mysql> select user, host, password from user;
+----------+-------------------+-------------------------------------------+
| user     | host              | password                                  |
+----------+-------------------+-------------------------------------------+
| root     | localhost         | *C76723A25A4C3CBCB1ABE27DF249CB2FE5D93C6D |
| root     | lptp1.txlinux.com | *C76723A25A4C3CBCB1ABE27DF249CB2FE5D93C6D |
| root     | 127.0.0.1         | *C76723A25A4C3CBCB1ABE27DF249CB2FE5D93C6D |
|          | localhost         |                                           |
|          | lptp1.txlinux.com |                                           |
| vpopmail | localhost         | *A455CE2217E33E0F6BBFF1CC93FEEADD81E612D4 |
| walkindb | localhost         | *2717916A73F7E5F932F40E12B46963B6F60BB3D3 |
| sitdb    | localhost         | *CFA0B33EE5F4E9CC9B19807BE646CADA177B04FD |
+----------+-------------------+-------------------------------------------+
8 rows in set (0.01 sec)

Try using the following to reset the root password when in safe mode:

UPDATE mysql.user SET Password=PASSWORD('root123') WHERE User='root';
FLUSH PRIVILEGES;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.