MySql Installation: Problems Past Installation

After installing MySql from Sources, the next step is to create a user. A user “root” will be created and there is a default password associated with it. I was not aware of the default password. So I faced some problems when starting mysql. Let’s see some of the problems while working with mysql.

Let’s start using mysql.


$ ./mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)

This error occurs because the mysql is not yet started.. So the next step is to start mysql daemon


$mysqld_safe

/mysqld_safe
100108 19:37:49 mysqld_safe Logging to '/usr/local/mysql/data/*.err'.
touch: /usr/local/mysql/data/*.err: Permission denied
chown: /usr/local/mysql/data/*.err: Permission denied
100108 19:37:50 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
./mysqld_safe: line 100: /usr/local/mysql/data/*.err: Permission denied
rm: /tmp/mysql.sock: Permission denied
rm: /usr/local/mysql/data/*.pid: Permission denied
./mysqld_safe: line 137: /usr/local/mysql/data/*.err: Permission denied
100108 19:37:50 mysqld_safe mysqld from pid file /usr/local/mysql/data/*.pid ended
./mysqld_safe: line 100: /usr/local/mysql/data/*.err: Permission denied

The above errors occurred because you need to be super user to start the mysql daemon


$ sudo mysqld_safe &

Now let’s start working with mysql. But do you know the password?


$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I faced this error while running for the first time. So we need to have a password (unless ofcourse if you know the default password)

Specify the password


$ sudo mysqladmin password "newpassword"

Now let’s start working with mysql


$ mysql -u root -p

Enter password:

Enter the password and you will see the mysql shell


mysql>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s