Quick Install (Centos 7) | 1. Download and install repo at https://dev.mysql.com/downloads/repo/yum/ rpm -ivh mysql57-community-release-el7-11.noarch.rpm
2. Install MYSQL server yum install -y mysql-community-server
3. Start and enable mysql server systemctl enable --now mysqld
4. Find temporary root password grep pass /var/log/mysqld.log
5. Replace temporary password mysql -uroot -p'temporary_pass' --connect-expired-password -Be "ALTER USER root@localhost IDENTIFIED BY 'new_root_pass';" # a valid root password in mysql 5.7 is Pass123^^ |
Recovering root password | 1. stop mysqld systemctl stop mysqld
2. start in safe mode mysqld_safe --skip-grant-tables &
3. login as root mysql -u root
4. update root password select mysql; update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root'; flush privileges; quit;
5. stop mysqld_safe daemon kill %1
6. start mysqld systemctl start mysqld
7. try root login mysql -u root -p |
Easy login | Add root password to ~/.my.cnf to avoid typing (insecure!)
[client] user=root password=Pass123^^
The next time you hit "mysql -uroot" you will be logged in automatically. |
No comments:
Post a Comment