Initial authorization issue in mysql -
i tried multiple ways install mysql , access database on fresh installation. os rhel 7. package used mysql-5.7.7-0.3.rc.el7.x86_64.rpm-bundle.tar
installation process: [root@host1 mysql]# rpm -ivh mysql-community-common-5.7.7-0.3.rc.el7.x86_64.rpm mysql-community-libs-5.7.7-0.3.rc.el7.x86_64.rpm mysql-community-client-5.7.7-0.3.rc.el7.x86_64.rpm mysql-community-server-5.7.7-0.3.rc.el7.x86_64.rpm preparing... ################################# [100%] updating / installing... 1:mysql-community-common-5.7.7-0.3.################################# [ 25%] 2:mysql-community-libs-5.7.7-0.3.rc################################# [ 50%] 3:mysql-community-client-5.7.7-0.3.################################# [ 75%] 4:mysql-community-server-5.7.7-0.3.################################# [100%]
then start server
systemctl start mysqld
after try access server no password root. error as:
[root@host1 mysql]# mysql -u root -p enter password: error 1045 (28000): access denied user 'root'@'localhost' (using password: no)
as have not set password, not sure why error comes. after tried various options , mone me.
option 1 : asks make file , change password using init file. tried using , got output as:
[root@host1 mysql]# mysqld_safe --init-file=/home/me/mysql-init & [1]28469 -bash: mysqld_safe: command not found
option 2 : set password using mysqladmin command
[root@host1 mysql]# /usr/bin/mysqladmin -u root password mysqladmin: connect server @ 'localhost' failed error: 'access denied user 'root'@'localhost' (using password: no)'
option 3 : using mysql_secure_installation
[root@host1 mysql]# mysql_secure_installation securing mysql server deployment. enter password root user: error: access denied user 'root'@'localhost' (using password: no)
option 4 : mysql -u root
[root@host1 mysql]# mysql -u root error 1045 (28000): access denied user 'root'@'localhost' (using password: no)
and various others. can please suggest can issue behind this.
for ever in pickle on this:
stop mysql server
create text file
onetime.sql
contains like:
set password 'root'@'localhost' = password('password789');
path file safe , other users can't it, perhaps /home/jason
- start mysql server
--init-file
option:
mysqld_safe --init-file=/home/jason/onetime.sql &
wait happily while password changed. wait won't long.
delete file ...
rm /home/jason/onetime.sql
stop mysql server
start mysql server normal way
edit may necessary :
once mysql has stopped,
edit /etc/my.cnf file add line
skip-grant-tables
restart
connect mysql using root user.
mysql -u root
once logged in, should see following prompt:
mysql>
enter following commands:
mysql> use mysql; mysql> update user set password=password("your new password here") user='root'; mysql> flush privileges; mysql> quit
now stop mysql again:
service mysqld stop
if edited /etc/my.cnf file, delete skip-grant-tables line.
now restart mysql , test new login.
Comments
Post a Comment