mysql 5843 1 14 10:11 ? 00:00:06 /u01/mysqlA/bin/mariadbd --defaults-file=/usr/service/mariadb/11.5.2/data/my.cnf ===================================================================================== error point - localhost connect fail ===================================================================================== [root@test4 ~]# mysql -uroot mysql: Deprecated program name. It will be removed in a future release, use '/u01/mariadb-11.5.2-linux-systemd-x86_64/bin/mariadb' instead ERROR 2002 (HY000): Can't connect to local server through socket '/tmp/mysql.sock' (2) [root@test4 ~]# mariadb -uroot ERROR 2002 (HY000): Can't connect to local server through socket '/tmp/mysql.sock' (2) [root@test4 ~]# mariadb -uroot --socket=$MARIA_DATA/mysql.sock Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 11.5.2-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> MariaDB [(none)]> create user test@'%' identified by 'welcome1' ; Query OK, 0 rows affected (0.002 sec) MariaDB [(none)]> grant all privileges on *.* to test@'%' ; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> flush privileges ; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> alter user root@'localhost' identified by 'welcome1' ; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> flush privileges ; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> exit ===================================================================================== ===================================================================================== [root@test4 ~]# mariadb -uroot -pwelcome1 ERROR 2002 (HY000): Can't connect to local server through socket '/tmp/mysql.sock' (2) [root@test4 ~]# mariadb -uroot -pwelcome1 --socket=$MARIA_DATA/mysql.sock Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 11.5.2-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> ===================================================================================== Connection Test from host(test2) to host(test4) - test user : test@'%' ===================================================================================== [root@test2 ~]# mysql -uroot -pwelcome1 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 13 Server version: 10.11.10-MariaDB-log MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> exit Bye [root@test2 ~]# mysql -h192.168.81.154 -P3306 -utest -pwelcome1 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 6 Server version: 11.5.2-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> MariaDB [(none)]> select @@hostname ; +------------+ | @@hostname | +------------+ | test4 | +------------+ 1 row in set (0.001 sec)