Feeds:
Posts
Comments

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

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.

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 :)

 

 

Greetings!

Today when i was working with helper methods for a ruby on rails project, i faced a problem of not rendering HTML tags in View

Instead it rendered as a String.

For example, the actual scenario is,

I had the following code in helper module

def show_list(num, page=nil)
..........
..........
content = []
for i in collection
content << "<li> #{i.name} </li>"
end
.........
.........
end

Inside view when i called this method

<%=  show_list(25) %>

I got the output as a string, “<li>actual data goes here</li>”, not interpreting the HTML tags

Then after surfing for nearly a couple of hours, i came to know that its a wrong way of calling the method in View

The right way  is to prefix the method using raw helper method

Correct way


<%= raw show_list(25) %>

Now the view displays the data as a list item :)

Hai, today when i created an empty database

rake db:create

for a rails project, i faced the following error

Error:

rake aborted!
undefined method `task’ for #<Pagescroll::Application:0xb74dcb0c>

(See full trace by running task with –trace)

To solve it,  i followed the  below steps which i found while surfing

The issue is because of the version of rake

Steps:

1. gem uninstall rake -v 0.9

2. gem install rake -v 0.8.7

3. Edit the Gemfile and add

i. gem ‘rake’, ’0.8.7′

4. bundle update

Now when i gave

rake db:create

It works  :)

Hai, iam using Fedora 14.

Today i cloned a repo from github.

When i executed the application i faced  the following mysql error

Mysql2::Error

Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

Then after googling, i came to know that we need to change the path ( must give the correct path of mysql.sock )  of a socket attribute in config/database.yml

To know its path, i just gave the following command

[rajee@localhost ~]$ locate mysql.sock

/var/lib/mysql/mysql.sock

Now the socket attribute path is changed as socket: /var/lib/mysql/mysql.sock

This path must also be changed in test, production in config/database.yml

Hope this helps for someone :)



To extract the rar format files on Fedora 14, as a root user type the following commands

Install free and non free yum repositories

rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

Install unrar

yum install unrar

Follow

Get every new post delivered to your Inbox.