Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-11589

Cannot log in to MariaDB as root, after running mysql_secure_installation

    XMLWordPrintable

Details

    Description

      I cannot log in to Maria DB after having created the root password.

      I have a new environment and had installed mariadb a couple weeks back but never got round to using it. I thought, maybe, I forgot the password. So I've completely removed it and re-installed it but it is the same issue. Cannot log in as root. JournalCtl -xe reports no errors.

      user@hostname:~$ sudo apt-get remove --purge mariadb-server
      Reading package lists... Done
      Building dependency tree       
      Reading state information... Done
      The following packages were automatically installed and are no longer required:
        mariadb-server-10.0 mariadb-server-core-10.0
      Use 'sudo apt autoremove' to remove them.
      The following packages will be REMOVED:
        mariadb-server*
      0 to upgrade, 0 to newly install, 1 to remove and 5 not to upgrade.
      After this operation, 61.4 kB disk space will be freed.
      Do you want to continue? [Y/n] Y
      (Reading database ... 218086 files and directories currently installed.)
      Removing mariadb-server (10.0.28-0ubuntu0.16.04.1) ...
      user@hostname:~$ sudo apt-get remove --purge mariadb-server*
      Reading package lists... Done
      Building dependency tree       
      Reading state information... Done
      Note, selecting 'mariadb-server-core-5.5' for glob 'mariadb-server*'
      Note, selecting 'mariadb-server-5.5' for glob 'mariadb-server*'
      Note, selecting 'mariadb-server-core-10.0' for glob 'mariadb-server*'
      Note, selecting 'mariadb-server-10.0' for glob 'mariadb-server*'
      Note, selecting 'mariadb-server' for glob 'mariadb-server*'
      Package 'mariadb-server-5.5' is not installed, so not removed
      Package 'mariadb-server-core-5.5' is not installed, so not removed
      Package 'mariadb-server' is not installed, so not removed
      The following packages will be REMOVED:
        mariadb-server-10.0* mariadb-server-core-10.0*
      0 to upgrade, 0 to newly install, 2 to remove and 5 not to upgrade.
      After this operation, 89.9 MB disk space will be freed.
      Do you want to continue? [Y/n] Y
      (Reading database ... 218083 files and directories currently installed.)
      Removing mariadb-server-10.0 (10.0.28-0ubuntu0.16.04.1) ...
      Purging configuration files for mariadb-server-10.0 (10.0.28-0ubuntu0.16.04.1) ...
      Removing mariadb-server-core-10.0 (10.0.28-0ubuntu0.16.04.1) ...
      Processing triggers for man-db (2.7.5-1) ...
      user@hostname:~$ ls /var/lib/mysql/
      aria_log.00000001  ibdata1      multi-master.info   performance_schema
      aria_log_control   ib_logfile0  mysql
      debian-10.0.flag   ib_logfile1  mysql_upgrade_info
      user@hostname:~$ sudo rm -rf /var/lib/mysql/
      user@hostname:~$ sudo rm -rf /etc/mysql/
      conf.d/          mariadb.cnf      my.cnf           
      debian.cnf       mariadb.conf.d/  my.cnf.fallback  
      user@hostname:~$ sudo rm -rf /etc/mysql/
      conf.d/          mariadb.cnf      my.cnf           
      debian.cnf       mariadb.conf.d/  my.cnf.fallback  
      user@hostname:~$ sudo rm -rf /etc/mysql/
      user@hostname:~$ sudo apt-get install mariadb-server
      Reading package lists... Done
      Building dependency tree       
      Reading state information... Done
      The following additional packages will be installed:
        mariadb-server-10.0 mariadb-server-core-10.0
      Suggested packages:
        mailx mariadb-test tinyca
      The following NEW packages will be installed:
        mariadb-server mariadb-server-10.0 mariadb-server-core-10.0
      0 to upgrade, 3 to newly install, 0 to remove and 5 not to upgrade.
      Need to get 0 B/8,617 kB of archives.
      After this operation, 89.9 MB of additional disk space will be used.
      Do you want to continue? [Y/n] Y
      Preconfiguring packages ...
      Selecting previously unselected package mariadb-server-core-10.0.
      (Reading database ... 217906 files and directories currently installed.)
      Preparing to unpack .../mariadb-server-core-10.0_10.0.28-0ubuntu0.16.04.1_amd64.deb ...
      Unpacking mariadb-server-core-10.0 (10.0.28-0ubuntu0.16.04.1) ...
      Selecting previously unselected package mariadb-server-10.0.
      Preparing to unpack .../mariadb-server-10.0_10.0.28-0ubuntu0.16.04.1_amd64.deb ...
      Unpacking mariadb-server-10.0 (10.0.28-0ubuntu0.16.04.1) ...
      Selecting previously unselected package mariadb-server.
      Preparing to unpack .../mariadb-server_10.0.28-0ubuntu0.16.04.1_all.deb ...
      Unpacking mariadb-server (10.0.28-0ubuntu0.16.04.1) ...
      Processing triggers for man-db (2.7.5-1) ...
      Processing triggers for systemd (229-4ubuntu13) ...
      Processing triggers for ureadahead (0.100.0-19) ...
      Setting up mariadb-server-core-10.0 (10.0.28-0ubuntu0.16.04.1) ...
      Setting up mariadb-server-10.0 (10.0.28-0ubuntu0.16.04.1) ...
      Setting up mariadb-server (10.0.28-0ubuntu0.16.04.1) ...
      Processing triggers for systemd (229-4ubuntu13) ...
      Processing triggers for ureadahead (0.100.0-19) ...
      user@hostname:~$ sudo my
      myisamchk                   mysql_embedded
      myisam_ftdump               mysql_find_rows
      myisamlog                   mysql_fix_extensions
      myisampack                  mysqlhotcopy
      my_print_defaults           mysqlimport
      mysql                       mysql_install_db
      mysqlaccess                 mysqloptimize
      mysqladmin                  mysql_plugin
      mysqlanalyze                mysqlrepair
      mysqlbinlog                 mysqlreport
      mysqlbug                    mysql_secure_installation
      mysqlcheck                  mysql_setpermission
      mysql_convert_table_format  mysqlshow
      mysqld                      mysqlslap
      mysqld_multi                mysql_tzinfo_to_sql
      mysqld_safe                 mysql_upgrade
      mysqldump                   mysql_waitpid
      mysqldumpslow               mysql_zap
      user@hostname:~$ sudo mysql_secure_installation 
       
      NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
            SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
       
      In order to log into MariaDB to secure it, we'll need the current
      password for the root user.  If you've just installed MariaDB, and
      you haven't set the root password yet, the password will be blank,
      so you should just press enter here.
       
      Enter current password for root (enter for none): 
      OK, successfully used password, moving on...
       
      Setting the root password ensures that nobody can log into the MariaDB
      root user without the proper authorisation.
       
      Set root password? [Y/n] Y
      New password: 
      Re-enter new password: 
      Password updated successfully!
      Reloading privilege tables..
       ... Success!
       
       
      By default, a MariaDB installation has an anonymous user, allowing anyone
      to log into MariaDB without having to have a user account created for
      them.  This is intended only for testing, and to make the installation
      go a bit smoother.  You should remove them before moving into a
      production environment.
       
      Remove anonymous users? [Y/n] Y
       ... Success!
       
      Normally, root should only be allowed to connect from 'localhost'.  This
      ensures that someone cannot guess at the root password from the network.
       
      Disallow root login remotely? [Y/n] Y
       ... Success!
       
      By default, MariaDB comes with a database named 'test' that anyone can
      access.  This is also intended only for testing, and should be removed
      before moving into a production environment.
       
      Remove test database and access to it? [Y/n] Y
       - Dropping test database...
       ... Success!
       - Removing privileges on test database...
       ... Success!
       
      Reloading the privilege tables will ensure that all changes made so far
      will take effect immediately.
       
      Reload privilege tables now? [Y/n] Y
       ... Success!
       
      Cleaning up...
       
      All done!  If you've completed all of the above steps, your MariaDB
      installation should now be secure.
       
      Thanks for using MariaDB!
      

      user@hostname:~$ mysql -u root -p
      Enter password: 
      ERROR 1698 (28000): Access denied for user 'root'@'localhost'
      user@hostname:~$ mysql -u root -p
      Enter password: 
      ERROR 1698 (28000): Access denied for user 'root'@'localhost'
      user@hostname:~$ mysql -u root -p
      Enter password: 
      ERROR 1698 (28000): Access denied for user 'root'@'localhost'
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            am AM
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.