[BlueOnyx:24361] In mysql, user at localhost and user at 127.0.0.1 are different.

Tomohiro Hosaka bokutin at gmail.com
Sun Oct 4 04:49:40 -05 2020


Hello.

I'm upgrading from 5208R to 5209R using /usr/sausalito/sbin/easy-migrate.pl
I noticed a mixture of username at 127.0.0.1 and username at localhost in mysql.
( select user,host from mysql.user )

After examining the source code, I realized that the cause is below.

On 5209R,
# ack -A 2 '== "localhost"'
/usr/sausalito/ui/chorizo/ci/application/modules/base/mysql/controllers/mysqlserver.php
        if ($sql_host == "localhost") {
            $sql_host = "127.0.0.1";
        }

On 5209R,
# diff -u /usr/sausalito/ui/chorizo/extensions/modifyWeb.Vsite/15_MYSQL_Vsite.php-00
/usr/sausalito/ui/chorizo/extensions/modifyWeb.Vsite/15_MYSQL_Vsite.php
--- /usr/sausalito/ui/chorizo/extensions/modifyWeb.Vsite/15_MYSQL_Vsite.php-00
 2020-10-04 18:34:18.656058318 +0900
+++ /usr/sausalito/ui/chorizo/extensions/modifyWeb.Vsite/15_MYSQL_Vsite.php
    2020-10-04 18:33:00.064625629 +0900
@@ -165,6 +165,12 @@
                     else {
                       $my_dbname = "";
                     }
+                    if (isset($featureMYSQL_Vsite['host'])) {
+                      $solmysql_host = $featureMYSQL_Vsite['host'];
+                    }
+                    if (isset($featureMYSQL_Vsite['Port'])) {
+                      $solmysql_Port = $featureMYSQL_Vsite['Port'];
+                    }
                 }


There is a difference between username at 127.0.0.1 and
username at localhost in mysql.
username at 127.0.0.1 is tcp/ip and mysql -h 127.0.0.1 ...
username at localhost is the unix domain socket and mysql ...

In BlueOnyx's admin panel, I don't think 127.0.0.1 and localhost
should be treated the same as the hostname of mysql.

The code that causes the problem
        if ($sql_host == "localhost") {
            $sql_host = "127.0.0.1";
        }

Such code will save the file once as localhost
    /usr/sausalito/codb/objects/*/.sql_host
    /usr/sausalito/codb/objects/*/MYSQL_Vsite.host
However, because the form value is 127.0.0.1, if I press the save
button without realizing it, it reverts to 127.0.0.1 and we are
confused.

I'd like to see improvements and answers.

Thanks,
Tomohiro Hosaka



More information about the Blueonyx mailing list