Common Errors

EMQ X cannot connect to Mysql8.0

Tags: MySQL Auth

TIP

4.3 is now compatible with caching_sha2_password, this issue only occurs in versions below 4.3

Different from previous versions, Mysql8.0 uses the caching_sha2_password plugin by default for account password configuration. The password plugin is required to change to mysql_native_password.

  • Modify the mysql.user table

    1. ## Switch to the mysql database
    2. mysql> use mysql;
    3. ## View user table
    4. mysql> select user, host, plugin from user;
    5. +------------------+-----------+-----------------------+
    6. | user | host | plugin |
    7. +------------------+-----------+-----------------------+
    8. | root | % | caching_sha2_password |
    9. | mysql.infoschema | localhost | caching_sha2_password |
    10. | mysql.session | localhost | caching_sha2_password |
    11. | mysql.sys | localhost | caching_sha2_password |
    12. | root | localhost | caching_sha2_password |
    13. +------------------+-----------+-----------------------+
    14. ## Change password plugin
    15. mysql> ALTER USER 'your_username'@'your_host' IDENTIFIED WITH mysql_native_password BY 'your_password';
    16. Query OK, 0 rows affected (0.01 sec)
    17. ## Refresh
    18. mysql> FLUSH PRIVILEGES;
    19. Query OK, 0 rows affected (0.00 sec)
  • Change my.conf

    Add a line below the [mysqld] in the my.cnf configuration file.

    1. default_authentication_plugin=mysql_native_password
  • Restart Mysql

Incorrect OPENSSL version

Tags: fail to start

Phenomenon

The output error from executing ./bin/emqx console includes:

  1. \{application_start_failure,kernel,\{\{shutdown,\{failed_to_start_child,kernel_safe_sup,\{on_load_function_failed,crypto\}\}\}, ..\}

It indicates that the “crypto” application in Erlang/OTP that EMQ X depends on failed to start.

Solution

Linux

Go to the installation directory of EMQ X (If you use the package management tool to install EMQ X, you should enter the same level directory as the lib of EMQ X)

  1. ## Package installation
  2. $ cd emqx
  3. ## Package manager installation, such as yum. Its lib directory should be in /lib/emqx
  4. $ cd /lib/emqx

Query the list of .so dynamic libraries that crypto depends on and its location in memory:

  1. $ ldd lib/crypto-*/priv/lib/crypto.so
  2. lib/crypto-4.6/priv/lib/crypto.so: /lib64/libcrypto.so.10: version `OPENSSL_1.1.1' not found (required by lib/crypto-4.6/priv/lib/crypto.so)
  3. linux-vdso.so.1 => (0x00007fff67bfc000)
  4. libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007fee749ca000)
  5. libc.so.6 => /lib64/libc.so.6 (0x00007fee74609000)
  6. libdl.so.2 => /lib64/libdl.so.2 (0x00007fee74404000)
  7. libz.so.1 => /lib64/libz.so.1 (0x00007fee741ee000)
  8. /lib64/ld-linux-x86-64.so.2 (0x00007fee74fe5000)

Among them, OPENSSL_1.1.1' not found indicates that the .so library of specified OPENSSL version is not installed correctly.

Compile and install OPENSSL 1.1.1 from source code, and place its so file to a path recognized by the system:

  1. ## Download the latest version 1.1.1
  2. $ wget https://www.openssl.org/source/openssl-1.1.1c.tar.gz
  3. ## Upload to ct-test-ha
  4. $ scp openssl-1.1.1c.tar.gz ct-test-ha:~/
  5. ## Unzip, compile and install
  6. $ tar zxf openssl-1.1.1c.tar.gz
  7. $ cd openssl-1.1.1c
  8. $ ./config
  9. $ make test # Perform test; continue if PASS is output
  10. $ make install
  11. ## Ensure library references
  12. $ ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
  13. $ ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

After the completion, execute ldd lib/crypto-*/priv/lib/crypto.so in the lib-level directory of EMQ X to check whether it can be correctly identified. If there is no .so library in not found, you can start EMQ X normally.

macOS

Go to the installation directory of EMQ X:

  1. ## package installation
  2. $ cd emqx
  3. ## brew installation
  4. $ cd /usr/local/Cellar/emqx/<version>/

Query the list of .so dynamic libraries that crypto depends on:

  1. $ otool -L lib/crypto-*/priv/lib/crypto.so
  2. lib/crypto-4.4.2.1/priv/lib/crypto.so:
  3. /usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
  4. /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)

It shows that OPENSSL has been successfully installed to the specified directory by checking:

  1. $ ls /usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib
  2. ls: /usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib: No such file or directory

If the file does not exist, you need to install the version of OPENSSL corresponding with what printed by otool. For example, it shown here as openssl@1.1:

  1. $ brew install openssl@1.1

After the installation is complete, you can start EMQ X normally.

MSVCR120.dll is missing from Windows

Tags: fail to start

Phenomenon

When Windows executes ./bin/emqx console, an error window pops up:

  1. This program cannot be started because MSVCR120.dll is missing from the computer. Please try to reinstall the program to resolve this issue.

Solution

Install Microsoft Visual C++ RedistributablePackageCommon errors - 图1 (opens new window)