Feeds:
Posts
Comments

Archive for August, 2011

Greetings!

To access MySQL db from terminal it is necessary to give its root password

Since i forgot its root password, i ended up with the following error

Error:

ERROR 1045 (28000): Access denied for user ‘root’@’localhost’

(using password: NO)

Then i followed the below steps to reset it

Steps:

1. [root@venus ~]# service mysqld stop

Stopping mysqld: [ OK ]

2. [root@venus ~]# mysqld_safe –skip-grant-tables & [1] 3735

3. [root@venus ~]# 110809 10:43:22 mysqld_safe Logging to ‘/var/log/mysqld.log’. 110809 10:43:22 mysqld_safe

Starting mysqld daemon with databases from /var/lib/mysql

4. [root@venus ~]# mysql -u root

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.56 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.

5. mysql> UPDATE user SET password=PASSWORD(“slash123″)WHERE user=”root”;

ERROR 1046 (3D000): No database selected

( Note: Here “slash123” is my mysql root password )

6. mysql> show databases;

+——————–+
| Database |
+——————–+
| information_schema |
| django |
| drupal |
| mysql |
| student |
| test |
+——————–+
6 rows in set (0.34 sec)

7. 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

8. mysql> UPDATE user SET password=PASSWORD(“slash123″)WHERE user=”root”;

Query OK, 3 rows affected (1.07 sec) Rows matched: 3 Changed: 3 Warnings: 0

9. mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

10. mysql> quit Bye

11. [rajee@venus ~]$ mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.1.56 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.

That’s it 🙂

Now i am able to access MySQL prompt from the terminal

Advertisements

Read Full Post »

Hai, today i faced a mysql connection problem while logging in to mysql prompt from the terminal

I am running on Fedora 14

Here i posted the error and its solution

Error:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

Solution:

To solve the above error, it is necessary to start The MySQL Server – mysqld 

Start MySQL server:

As a root user, start the mysql server

service mysqld start

Stop MySQL server:

As a root user, stop the mysql server

service mysqld stop

Note: The file mysql.sock is automatically created when the MySQL server ( mysqld ) runs, otherwise it is not.

Read Full Post »

Hai, though i am 70% confirmed in using GNOME environment, but bit doubtful regarding, “Whether iam using Gnome or Kde desktop environment in Fedora 14”

To check it, did a bit surfing and confirmed with GNOME.

You can verify it using gui or terminal

Using GUI:

On Fedora, form the top panel click on  System -> About this Computer. Now you can see GNOME or KDE with its version number

On Ubuntu, you can find directly as System -> About GNOME or System -> About KDE

Using Terminal:

Type the following command in the terminal.

echo $DESKTOP_SESSION 

You can see the output as gnome (if gnome present) or kde (if kde present)

Click here for the source 🙂

 

 

Read Full Post »