I tried several ways to install mySql and then access the database on a new installation. OS is RHEL 7. Package used: mysql-5.7.7-0.3.rc.el7.x86_64.rpm-bundle.tar
installation process:
[root@host1 mysql]
Preparing...
Updating / installing...
1:mysql-community-common-5.7.7-0.3.
2:mysql-community-libs-5.7.7-0.3.rc
3:mysql-community-client-5.7.7-0.3.
4:mysql-community-server-5.7.7-0.3.
then i start the server
systemctl start mysqld
After that, I try to access the server without a password for root. I get an error like:
[root@host1 mysql]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Since I did not set a single password, I am not very sure why this error occurs. After that, I tried various options, and Mont could help me.
option 1: asks to make a file and change the password using the initialization file. I tried using this and got output like:
[root@host1 mysql]
-bash: mysqld_safe: command not found
Option 2: set the password using the mysqladmin command
[root@host1 mysql]
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
Option 3: using mysql_secure_installation
[root@host1 mysql]# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for root user:
Error: Access denied for user 'root'@'localhost' (using password: NO)
Option 4: mysql -u root
[root@host1 mysql]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
. , .