What is initial mysql root password in zabbix_server_mysql?

15,341

zabbix-mysql-server will install mysql (or mariadb) if it's not installed yet on your system, as it is a dependency, but it will not provide a default root password.

Once your installation of mysql is done, try launching

mysql_secure_installation

and you'll be able to set the root password of your MySQL installation.

Only after this, you can follow the documentation to create the db, user, etc..

The Zabbix documentation, the way it is written, is assuming that your MySQL is already installed and properly configured. In your situation, it's not done.

Share:
15,341

Related videos on Youtube

asleea
Author by

asleea

Updated on September 18, 2022

Comments

  • asleea
    asleea almost 2 years

    I followed the instruction to install zabbix_server_mysql 3.2 in Ubuntu16.

    wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb
    dpkg -i zabbix-release_3.2-1+xenial_all.deb
    apt-get update
    apt-get install zabbix-server-mysql zabbix-frontend-php
    

    After complete to install, I try to connect mysql for the next instruction like below.

    Creating initial database
    
    Create Zabbix database and user on MySQL by the following commands, where <root_password> shall be replaced with the actual root password (e.g., shell> mysql -uroot -p12345) and <password> with new password for zabbix user on the database (including apostrophes: …identified by '67890';):
    
    shell> mysql -uroot -p<root_password>
    mysql> create database zabbix character set utf8 collate utf8_bin;
    mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
    mysql> quit;
    

    It is saying I need to type the actual root's password even though I have never set root password while installing zabbix_server_mysql.

    At the first I tried to assume default password like empty string "", "root" and "zabbix" something.

    Then I tried to change root password to what I want.

    $sudo service mysql stop
    $sudo mysqld_safe --skip-grant-tables
    
    # Another terminal
    $mysql -uroot mysql
    mysql > update user set password=PASSWORD("root") where User='root';
    mysql > flush privileges;
    mysql > quit;
    $ sudo service mysql restart
    $ mysql -uroot -proot
    ERROR 1698 (28000): Access denied for user 'root'@'localhost'
    

    Unfortunately, these seem not to work as I don't know why.

    I have been stuck for quite long time, even not starting zabbix at all.

    Could you give me an advice ?

    Edit -------------------------------------------------

    dpkg -l | grep mysql
    ii  libdbd-mysql-perl                     4.033-1ubuntu0.1                                            amd64        Perl5 database interface to the MySQL database
    ii  libmysqlclient20:amd64                5.7.17-0ubuntu0.16.04.1                                     amd64        MySQL database client library
    ii  mysql-common                          5.7.17-0ubuntu0.16.04.1                                     all          MySQL database common files, e.g. /etc/mysql/my.cnf
    ii  php-mysql                             1:7.0+35ubuntu6                                             all          MySQL module for PHP [default]
    ii  php7.0-mysql                          7.0.13-0ubuntu0.16.04.1                                     amd64        MySQL module for PHP
    ii  zabbix-server-mysql                   1:3.2.3-1+xenial                                            amd64        Zabbix network monitoring solution - server (MySQL)
    
    • Khaled
      Khaled over 7 years
      Did you try sudo dpkg-reconfigure mysql-server-version? Replace "version" with something like 5.6.
    • asleea
      asleea over 7 years
      @Khaled sudo dpkg-reconfigure shows only mysql-common is available for mysql and it doesn't have any effect with mysql-common.
    • Khaled
      Khaled over 7 years
      No mysql-server package!? How did you install mysql server?
    • asleea
      asleea over 7 years
      @Khaled I didn't install mysql separately, it seems zabbix_server_mysql to install it together, that is why I am asking it on server fault if there is default password zabbix_server_mysql set for root user while installing it.
    • Khaled
      Khaled over 7 years
      Can you post the output of dpkg -l | grep mysql?
    • asleea
      asleea over 7 years
      @Khaled I edit my post adding result of dpkg -l | grep mysql.
  • asleea
    asleea over 7 years
    mysql_secure_installation still ask me root password even though it is saying 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. blank doesn't work.........
  • SBO
    SBO over 7 years
    Because you've changed it, right ? If you want to do a "fresh" install and start over, try this : apt-get --yes purge mysql-server mysql-client && apt-get --yes autoremove --purge && apt-get autoclean then reinstall mysql-server and try again, you should be fine.
  • SBO
    SBO over 7 years
    Is it now solved ?
  • asleea
    asleea over 7 years
    Thank you for your attention but It was still the same, finally I just installed mysql separately and it worked.
  • RalfFriedl
    RalfFriedl over 5 years
    This doesn't answer the question. The problem is that the root password is unknown.