access denied after mysql_install_db --user=mysql

  • Filter
  • Time
  • Show
Clear All
new posts

  • access denied after mysql_install_db --user=mysql

    I had mysql data dir on separate hdd. And yesterday this hdd died.The hdd was replaced and I was trying to restore from backup. However it was not successfull.
    Moreover I cannot start mysql from clean db.
    I removed all files from /var/lib/mysql data dir and then run

    mysql_install_db --user=mysql

    but after start mysql

    service mysql restart

    I have strange error
    Stopping MySQL database server: mysqld.
    Starting MySQL database server: mysqld ..
    Checking for corrupt, not cleanly closed and upgrade needing tables..
    root@c-a060-u1769-142:/var/lib/mysql# ERROR 1045 (28000): Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)

    but I don't request login to mysql just start daemon.

    mysql error log

    140327 08:10:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql/
    2014-03-27 08:10:39 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2014-03-27 08:10:39 32593 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
    2014-03-27 08:10:39 32593 [Note] Plugin 'FEDERATED' is disabled.
    2014-03-27 08:10:39 32593 [Note] InnoDB: The InnoDB memory heap is disabled
    2014-03-27 08:10:39 32593 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2014-03-27 08:10:39 32593 [Note] InnoDB: Compressed tables use zlib 1.2.3
    2014-03-27 08:10:39 32593 [Note] InnoDB: Using Linux native AIO
    2014-03-27 08:10:39 32593 [Note] InnoDB: Using CPU crc32 instructions
    2014-03-27 08:10:39 32593 [Note] InnoDB: Initializing buffer pool, size = 8.0G
    2014-03-27 08:10:39 32593 [Note] InnoDB: Completed initialization of buffer pool
    2014-03-27 08:10:39 32593 [Note] InnoDB: Highest supported file format is Barracuda.
    2014-03-27 08:10:40 32593 [Note] InnoDB: 128 rollback segment(s) are active.
    2014-03-27 08:10:40 32593 [Note] InnoDB: Waiting for purge to start
    2014-03-27 08:10:40 32593 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.14-rel62.0 started; log sequence number 1628787
    2014-03-27 08:10:40 32593 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
    2014-03-27 08:10:40 32593 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
    2014-03-27 08:10:40 32593 [Note] Server hostname (bind-address): ''; port: 3306
    2014-03-27 08:10:40 32593 [Note] - '' resolves to '';
    2014-03-27 08:10:40 32593 [Note] Server socket created on IP: ''.
    2014-03-27 08:10:40 32593 [Note] Event Scheduler: Loaded 0 events
    2014-03-27 08:10:40 32593 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.6.14-62.0-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Percona Server (GPL), Release 62.0

    I'm using percona server 5.6

  • #2

    In Debian, It has a MySQL account debian-sys-maint used for switching on/off and checking status. The password for that user should be the same as stored in /etc/mysql/debian.cnf. so if your server has not account like debian-sys-maint then create the user with password mentioned in /etc/mysql/debian.cnf and try again.
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'password';