1. Uninstalling Mysql

  • Use dpkg --get-selections | grep mysql to list all softwares related to Mysql, then uninstall them with sudo apt-get --purge remove NAME

    ➜  ~ dpkg --get-selections | grep mysql
    default-mysql-client             install
    libdbd-mysql-perl                install
    libmysqlclient18:amd64           deinstall
    mysqll-apt-config                install
    ......
      
    sudo apt-get --purge remove mysql-server
    sudo apt-get --purge remove mysql-apt-config
    sudo apt-get --purge remove ...
    ......
    

2. Installing Mysql

  • Installation steps link

3. Creating a new user

  • Create a new user and grant all privileges to the new user (From link)

    // replace localhost with % to allow remote access
    mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost' (WITH GRANT OPTION);
    mysql> FLUSH PRIVILEGES;
    

REF

  1. Debian 9安装MySql