patternsqlMajor
Setting root password in fresh mysql 5.7 installation
Viewed 0 times
passwordinstallationsettingfreshmysqlroot
Problem
I am trying to install mysql in a serving having
Output:
I ran the mysql damon:
Checking the service:
Here comes the problem driving me crazy. I want to set root password for the very first time, so I did:
But the output: Securing the MySQL server deployment.
Enter password for user root: Error: Access denied for
CentOS Linux release 7.2.1511. Take a look to the process installation:# sudo yum install mysql-serverOutput:
Dependencies Resolved
===========================================================================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================================================================
Removing:
mysql-community-client x86_64 5.7.10-1.el7 @mysql57-community 109 M
mysql-community-server x86_64 5.7.10-1.el7 @mysql57-community 652 M
Transaction Summary
===========================================================================================================================================================================================================I ran the mysql damon:
# sudo service mysqld startChecking the service:
# ps -ef|grep mysql
mysql 1371 1 0 22:17 ? 00:00:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pidHere comes the problem driving me crazy. I want to set root password for the very first time, so I did:
# sudo mysql_secure_installation
// when password is required, I just type "enter key"But the output: Securing the MySQL server deployment.
Enter password for user root: Error: Access denied for
Solution
If you just run mysql command under root user you will be granted access without asked for password, because socket authentication enabled for root@localhost.
This guide is misleading.
The only way to set password is to switch to native authentication like:
This guide is misleading.
The only way to set password is to switch to native authentication like:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';Code Snippets
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';Context
StackExchange Database Administrators Q#127537, answer score: 23
Revisions (0)
No revisions yet.