I got one VPS server, a legacy, so to speak. The former owner does not get in touch. How can I find out the root password for the MySQL database? Where is it stored in the Ubuntu 14.04 file system?

    3 answers 3

    There is a great article with simple steps on how to reset a root password in MySQL: http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password

    • Answer - link! - Visman
    • spigot, cap :) - Invision

    it is natural to find out the password (except that the former owner wrote it down somewhere “for memory”).

    but you can set your own password. This is described on the Internet many times. I repeat for the story:

    $ sudo dpkg-reconfigure mysql-server-5.5 

    numbers ("5.5") on your system may vary. in the default installation, bash-completion works, so by typing the whole command up to mysql-server and double mysql-server clicking the tab , you will see which version of the mysql-server package is installed on your system.

    if autocompletion fails, you can find out the version, for example, like this:

     $ dpkg --get-selections | grep mysql-server- 

    approximate output of this command:

     mysql-server-5.5 install mysql-server-core-5.5 install 

      Stop MySQL service

      Ubuntu and Debian:

       sudo /etc/init.d/mysql stop 

      CentOS, Fedora, Red Hat Enterprise Linux

       sudo /etc/init.d/mysqld stop 

      Start MySQL without password

       sudo mysqld_safe --skip-grant-tables & 

      MySQL connection

       mysql -uroot 

      Set MySQL root password

       use mysql; update user set password=1234 where User='root'; flush privileges; quit 

      Stopping and starting the MySQL service

      Ubuntu and Debian

       sudo /etc/init.d/mysql stop ... sudo /etc/init.d/mysql start 

      CentOS, Fedora, and Red Hat Enterprise Linux

       sudo /etc/init.d/mysqld stop ... sudo /etc/init.d/mysqld start 

      Log into the database

       mysql -u root -p 1234