Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.) I opened the terminal and typed in `su - ` to run as root.
- 2.) I then ran `mysql - u root`, which resulted in a lot of output and another prompt.
- 3.) I then typed in `UPDATE mysql.user SET Password=PASSWORD('NewPassHere')
- WHERE User='root';`
- -bash: syntax error near unexpected token `('
- bash: UPDATE: command not found...
- [root@localhost ~]# /usr/bin/mysqladmin -u root password 'newpwd'
- /usr/bin/mysqladmin: connect to server at 'localhost' failed
- error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
- Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
- [root@localhost ~]# sudo service mysqld status
- Redirecting to /bin/systemctl status mysqld.service
- mysqld.service
- Loaded: not-found (Reason: No such file or directory)
- Active: inactive (dead)
- [root@localhost ~]# sudo service mysqld start
- Redirecting to /bin/systemctl start mysqld.service
- Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.
- /usr/bin/mysqladmin -u root password 'new-password'
- SELECT user, host FROM mysql.user WHERE user = 'root';
- /usr/bin/mysqladmin -u root password 'new-password' -h127.0.0.1
- [root@mail ~]# yum install mysql-server
- [root@mail ~]# chkconfig mysqld on
- [root@mail ~]# service mysqld start
- [root@mail ~]# mysql_secure_installation
- Enter current password for root (enter for none):
- OK, successfully used password, moving on...
- Set root password? [Y/n] y
- New password:
- Re-enter new password:
- Password updated successfully!
- Remove anonymous users? [Y/n] y
- ... Success!
- Disallow root login remotely? [Y/n] n
- ... skipping.
- Remove test database and access to it? [Y/n] y
- - Dropping test database...
- ... Success!
- - Removing privileges on test database...
- ... Success!
- Reload privilege tables now? [Y/n] y
- ... Success!
- Cleaning up...
- All done! If you've completed all of the above steps, your MySQL
- installation should now be secure.
- Thanks for using MySQL!
- mysql -u root -p
- use mysql
- update user set authentication_string=password('NEWPASSWORD') where user='root';
- flush privileges;
- quit
- mysql -u root
Add Comment
Please, Sign In to add comment