Tag: mysql8

  • MySQL 8

    MySQL 8

    MySQL 8 use caching_sha2_password as the default authentication method. Many MySQL clients still do not support this method. If you need to use the old method, you can set the authentication plugin as mysql_native_password. You can also set this as the default method by editing my.cnf file.

    [mysqld]
    default_authentication_plugin=mysql_native_password

    To change a user to use mysql_native_password, run

    ALTER USER 'USERNAME'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'PASSWORD_HERE';
  • Install MySQL 8 on CentOS, RHEL 6/7

    Install MySQL 8 on CentOS, RHEL 6/7

    To Add MySQL yum repository to your server, go to

    https://dev.mysql.com/downloads/repo/yum/

    Download the rpm file available.

    For RHEL/CentOS 7

    wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
    rpm -ivh mysql80-community-release-el7-3.noarch.rpm
    

    For RHEL/CentOS 6

    wget https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm
    rpm -ivh mysql80-community-release-el6-1.noarch.rpm
    

    Installing MySQL Server

    yum install mysql-community-server
    

    Stop/Start MySQL

    To stop/start MySQL, use service name “mysqld”.

    systemctl start mysqld
    systemctl stop mysqld
    systemctl restart mysqld
    

    MySQL 8 root Password

    When MySQL first starts, it create a random password and store in MySQL log file. To find the MySQL root password, run

    grep 'temporary password' /var/log/mysqld.log
    

    This default password don’t allow you to do anything, so login to MySQL with this password and set a secure password for root.

    ALTER USER 'root'@'localhost' IDENTIFIED  BY 'MYSQL_ROOT_PASSOWRD';
    

    MYSQL_ROOT_PASSOWRD – replace it with you secure new MySQL root password.

    Installing Older Version of MySQL

    When you add MySQL repository, it activate latest version by default. If you want older version, say 5.7, you need to activate it.

    To see available repository, run

    yum repolist all | grep mysql
    

    To disable MySQL 8 repository, run

    yum-config-manager --disable mysql80-community
    

    To enable MySQL 5.7 repository, run

    yum-config-manager --enable mysql57-community
    

    Now installing MySQL server will install MySQL 5.7 instead of latest version.

    MySQL CentOS

  • Install MySQL 8 on Ubuntu/Debian

    Install MySQL 8 on Ubuntu/Debian

    To install MySQL 8 on Ubuntu/Debian, download the .deb repository file from

    https://dev.mysql.com/downloads/repo/apt/

    Following link may change, so always get newer version download link from above url.

    wget https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb
    dpkg -i mysql-apt-config_0.8.24-1_all.deb
    

    It ask you to select MySQL version, default is 8, just press down arrow and select “Ok”.

    Now you are ready to install MySQL 8, you need to run apt update before you can install.

    apt update
    apt install mysql-server
    

    It ask you to enter password.

    Next it ask you to select password format.

    MySQL 8 have a different authentication plugin, that use more secure password format. You can select Legacy Authentication for compatibility with MySQL version 5.x

    Changing MySQL version

    if you want to install differnt MySQL version, uninstall current MySQL version, then select a differnt MySQL version by running

    dpkg-reconfigure  mysql-apt-config
    

    MySQL 8 apt Error The following signatures were invalid
    mysql