Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-23015

mariadb-setpermission seems incompatible with DBI:MariaDB

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.5.4
    • 10.5.10
    • Scripts & Clients
    • None
    • Linux CentOS 7.7

    Description

      When running mariadb-setpermission it fails to connect to MariaDB. On line 89 (in MariaDB 10.5.4) it tries to connect using port/host and mariadb_socket, and all three of these cannot be used together. You get the error:
      Can't make a connection to the mysql server.
      The error: Connection error: host or port cannot be specified together with mariadb_socket at /usr/bin/mariadb-setpermission line 89, <STDIN> line 1.

      Attachments

        Issue Links

          Activity

            It seems to be a problem specific to DBD::MariaDB. In previous versions, which use DBD::mysql, it works fine.

            elenst Elena Stepanova added a comment - It seems to be a problem specific to DBD::MariaDB. In previous versions, which use DBD::mysql, it works fine.

            Since we cannot control DBD::MariaDB, I guess it has to be worked around in the script itself.

            elenst Elena Stepanova added a comment - Since we cannot control DBD::MariaDB, I guess it has to be worked around in the script itself.
            anel Anel Husakovic added a comment - - edited

            Hi sanja can you please review 9e5202f6f96?

            $ ./scripts/mariadb-setpermission --socket=/tmp/mysql.sock
            Options read from mycnf:
            user=anel
            password=
            Password for user anel to connect to MariaDB: 
            ######################################################################
            ## Welcome to the permission setter 1.4 for MariaDB.
            ## made by Luuk de Boer
            ######################################################################
            What would you like to do:
              1. Set password for an existing user.
              2. Create a database + user privilege for that database
                 and host combination (user can only do SELECT)
              3. Create/append user privilege for an existing database
                 and host combination (user can only do SELECT)
              4. Create/append broader user privileges for an existing
                 database and host combination
                 (user can do SELECT,INSERT,UPDATE,DELETE)
              5. Create/append quite extended user privileges for an
                 existing database and host combination (user can do
                 SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,
                 LOCK TABLES,CREATE TEMPORARY TABLES)
              6. Create/append full privileges for an existing database
                 and host combination (user has FULL privilege)
              7. Remove all privileges for for an existing database and
                 host combination.
                 (user will have all permission fields set to N)
              0. exit this program
             
            Make your choice [1,2,3,4,5,6,7,0]:
            

            or

            $ ./scripts/mariadb-setpermission --host=anel --user=t --password=ttt
            Options read from mycnf:
            ######################################################################
            ## Welcome to the permission setter 1.4 for MariaDB.
            ## made by Luuk de Boer
            ######################################################################
            What would you like to do:
              1. Set password for an existing user.
              2. Create a database + user privilege for that database
                 and host combination (user can only do SELECT)
              3. Create/append user privilege for an existing database
                 and host combination (user can only do SELECT)
              4. Create/append broader user privileges for an existing
                 database and host combination
                 (user can do SELECT,INSERT,UPDATE,DELETE)
              5. Create/append quite extended user privileges for an
                 existing database and host combination (user can do
                 SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,
                 LOCK TABLES,CREATE TEMPORARY TABLES)
              6. Create/append full privileges for an existing database
                 and host combination (user has FULL privilege)
              7. Remove all privileges for for an existing database and
                 host combination.
                 (user will have all permission fields set to N)
              0. exit this program
             
            Make your choice [1,2,3,4,5,6,7,0]: 1
            

            The patch is also related to MDEV-23016.

            Also there was a question on KB https://mariadb.com/kb/en/mysql_setpermission-depracated/
            I agree that we should use chmod to this file, right?

            anel Anel Husakovic added a comment - - edited Hi sanja can you please review 9e5202f6f96 ? $ ./scripts/mariadb-setpermission --socket=/tmp/mysql.sock Options read from mycnf: user=anel password= Password for user anel to connect to MariaDB: ###################################################################### ## Welcome to the permission setter 1.4 for MariaDB. ## made by Luuk de Boer ###################################################################### What would you like to do: 1. Set password for an existing user. 2. Create a database + user privilege for that database and host combination (user can only do SELECT) 3. Create/append user privilege for an existing database and host combination (user can only do SELECT) 4. Create/append broader user privileges for an existing database and host combination (user can do SELECT,INSERT,UPDATE,DELETE) 5. Create/append quite extended user privileges for an existing database and host combination (user can do SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX, LOCK TABLES,CREATE TEMPORARY TABLES) 6. Create/append full privileges for an existing database and host combination (user has FULL privilege) 7. Remove all privileges for for an existing database and host combination. (user will have all permission fields set to N) 0. exit this program   Make your choice [1,2,3,4,5,6,7,0]: or $ ./scripts/mariadb-setpermission --host=anel --user=t --password=ttt Options read from mycnf: ###################################################################### ## Welcome to the permission setter 1.4 for MariaDB. ## made by Luuk de Boer ###################################################################### What would you like to do: 1. Set password for an existing user. 2. Create a database + user privilege for that database and host combination (user can only do SELECT) 3. Create/append user privilege for an existing database and host combination (user can only do SELECT) 4. Create/append broader user privileges for an existing database and host combination (user can do SELECT,INSERT,UPDATE,DELETE) 5. Create/append quite extended user privileges for an existing database and host combination (user can do SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX, LOCK TABLES,CREATE TEMPORARY TABLES) 6. Create/append full privileges for an existing database and host combination (user has FULL privilege) 7. Remove all privileges for for an existing database and host combination. (user will have all permission fields set to N) 0. exit this program   Make your choice [1,2,3,4,5,6,7,0]: 1 The patch is also related to MDEV-23016 . Also there was a question on KB https://mariadb.com/kb/en/mysql_setpermission-depracated/ I agree that we should use chmod to this file, right?

            Hi sanja here is the patch for compatibility with DBD::mysql : patch
            Example (used print for dsn temporary) :

            DBD::MariaDB

            $ ./scripts/mariadb-setpermission --socket=/tmp/mysql.sock
            Options read from mycnf:
            ------------------------
            Password for user  to connect to MariaDB: 
            I used dsn: DBI:MariaDB:;mariadb_socket=/tmp/mysql.sock
            

            Uninstall DBD::MariaDB

             sudo cpanm --uninstall DBD::MariaDB
            DBD::MariaDB contains the following files:
             
              /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/DBD/MariaDB.pm
              /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/DBD/MariaDB.pod
              /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/DBD/MariaDB/INSTALL.pod
              /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/DBD/README.pod
              /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/auto/DBD/MariaDB/MariaDB.so
              /usr/local/man/man3/DBD::MariaDB.3pm
              /usr/local/man/man3/DBD::MariaDB::INSTALL.3pm
             
            Are you sure you want to uninstall DBD::MariaDB? [y] y
             
            Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/DBD/MariaDB.pm
            Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/DBD/MariaDB.pod
            Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/DBD/MariaDB/INSTALL.pod
            Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/DBD/README.pod
            Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/auto/DBD/MariaDB/MariaDB.so
            Unlink: /usr/local/man/man3/DBD::MariaDB.3pm
            Unlink: /usr/local/man/man3/DBD::MariaDB::INSTALL.3pm
            Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/auto/DBD/MariaDB/.packlist
             
            Successfully uninstalled DBD::MariaDB
            

            DBD::mysql

            $ ./scripts/mariadb-setpermission --socket=/tmp/mysql.sock
            Options read from mycnf:
            ------------------------
            Password for user  to connect to MariaDB: 
            I used dsn: DBI:mysql:;mysql_socket=/tmp/mysql.sock
            

            anel Anel Husakovic added a comment - Hi sanja here is the patch for compatibility with DBD::mysql : patch Example (used print for dsn temporary) : DBD::MariaDB $ . /scripts/mariadb-setpermission --socket= /tmp/mysql .sock Options read from mycnf: ------------------------ Password for user to connect to MariaDB: I used dsn: DBI:MariaDB:;mariadb_socket= /tmp/mysql .sock Uninstall DBD::MariaDB sudo cpanm --uninstall DBD::MariaDB DBD::MariaDB contains the following files:   /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /DBD/MariaDB .pm /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /DBD/MariaDB .pod /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /DBD/MariaDB/INSTALL .pod /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /DBD/README .pod /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /auto/DBD/MariaDB/MariaDB .so /usr/local/man/man3/DBD ::MariaDB.3pm /usr/local/man/man3/DBD ::MariaDB::INSTALL.3pm   Are you sure you want to uninstall DBD::MariaDB? [y] y   Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /DBD/MariaDB .pm Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /DBD/MariaDB .pod Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /DBD/MariaDB/INSTALL .pod Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /DBD/README .pod Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /auto/DBD/MariaDB/MariaDB .so Unlink: /usr/local/man/man3/DBD ::MariaDB.3pm Unlink: /usr/local/man/man3/DBD ::MariaDB::INSTALL.3pm Unlink: /usr/local/lib/x86_64-linux-gnu/perl/5 .26.1 /auto/DBD/MariaDB/ .packlist   Successfully uninstalled DBD::MariaDB DBD::mysql $ . /scripts/mariadb-setpermission --socket= /tmp/mysql .sock Options read from mycnf: ------------------------ Password for user to connect to MariaDB: I used dsn: DBI:mysql:;mysql_socket= /tmp/mysql .sock

            OK to push (afterall it is internal scripts)

            sanja Oleksandr Byelkin added a comment - OK to push (afterall it is internal scripts)

            Pushed with 18a829012

            anel Anel Husakovic added a comment - Pushed with 18a829012

            People

              anel Anel Husakovic
              karlsson Anders Karlsson
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.