Showing posts with label no. Show all posts
Showing posts with label no. Show all posts

Tuesday, 26 April 2016

Access denied for user 'ec2-user'@'localhost' (using password: NO)

Access denied for user 'ec2-user'@'localhost' (using password: NO)

ref : ()

a) grep 'temporary password' /var/log/mysqld.log

login with temp password.

b) mysql -u root -p
password : 'temporary password'

(or)

mysql> UPDATE mysql.user SET Password=PASSWORD('your_new_password') WHERE User='root';

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> SET PASSWORD = PASSWORD('your_new_password');

Query OK, 0 rows affected, 1 warning (0.01 sec)

follow step - b.

ref : stackoverflow for a
stackoverflow : for b.



Tuesday, 19 April 2016

No database selected

ERROR 1046 (3D000): No database selected

we have two scenario
1) check if database exist.
2) if database not exist, create and use the database.

for case 1.

1) see database.
cmd :  show databases.
it will show default listing.
+--------------------+
| Database           |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec

now we have to create the DB and recheck again.

2)  if database not exist, create and use the database.
a) create database test.
cmd : create database test.
b) check test db created or not.
cmd : show databases.

+--------------------+
| Database           |
+--------------------+
| information_schema |
  test
+--------------------+
1 row in set (0.00 sec

c) start using the database.
cmd : use test.