Override database option in a user-specific .my.cnf config file












1















Using MariaDB 10.2.15 (Linux Debian Stretch)



I have created a ~/.my.cnf config file in my home directory in order to set a default database at connection time for all local client tools:



[client]
user=myuser
password=mySecretPassword
database=mydb


But I want to unset (skip) option database for a specific client program (mysqldump). This is to prevent such warning when running mysqldump:



Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb'


I was hoping using skip-OPTIONNAME in a [mysqldump] section would have worked, but unfortunately it doesn't.



[client]
user=myuser
password=mySecretPassword
database=mydb

[mysqldump]
skip-database


In fact, I noticed that database is multi-value. So overriding it is not really possible. For example, the following .my.cnf config file:



[client]
user=myuser
password=mySecretPassword
database=mydb

[mysqldump]
database=mydb2


produces 2 warnings when running mysqldump:



Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb'
Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb2'


Is there a way to "unset" option database in an overridden section?










share|improve this question














bumped to the homepage by Community 18 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Does it work/help to have a line database= in the 'mysqldump' section?

    – dbdemon
    Jun 30 '18 at 15:43











  • Thanks @dbdemon, I tried database= (empty value) but it does not help.

    – Nicolas Payart
    Jul 2 '18 at 8:09
















1















Using MariaDB 10.2.15 (Linux Debian Stretch)



I have created a ~/.my.cnf config file in my home directory in order to set a default database at connection time for all local client tools:



[client]
user=myuser
password=mySecretPassword
database=mydb


But I want to unset (skip) option database for a specific client program (mysqldump). This is to prevent such warning when running mysqldump:



Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb'


I was hoping using skip-OPTIONNAME in a [mysqldump] section would have worked, but unfortunately it doesn't.



[client]
user=myuser
password=mySecretPassword
database=mydb

[mysqldump]
skip-database


In fact, I noticed that database is multi-value. So overriding it is not really possible. For example, the following .my.cnf config file:



[client]
user=myuser
password=mySecretPassword
database=mydb

[mysqldump]
database=mydb2


produces 2 warnings when running mysqldump:



Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb'
Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb2'


Is there a way to "unset" option database in an overridden section?










share|improve this question














bumped to the homepage by Community 18 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Does it work/help to have a line database= in the 'mysqldump' section?

    – dbdemon
    Jun 30 '18 at 15:43











  • Thanks @dbdemon, I tried database= (empty value) but it does not help.

    – Nicolas Payart
    Jul 2 '18 at 8:09














1












1








1








Using MariaDB 10.2.15 (Linux Debian Stretch)



I have created a ~/.my.cnf config file in my home directory in order to set a default database at connection time for all local client tools:



[client]
user=myuser
password=mySecretPassword
database=mydb


But I want to unset (skip) option database for a specific client program (mysqldump). This is to prevent such warning when running mysqldump:



Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb'


I was hoping using skip-OPTIONNAME in a [mysqldump] section would have worked, but unfortunately it doesn't.



[client]
user=myuser
password=mySecretPassword
database=mydb

[mysqldump]
skip-database


In fact, I noticed that database is multi-value. So overriding it is not really possible. For example, the following .my.cnf config file:



[client]
user=myuser
password=mySecretPassword
database=mydb

[mysqldump]
database=mydb2


produces 2 warnings when running mysqldump:



Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb'
Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb2'


Is there a way to "unset" option database in an overridden section?










share|improve this question














Using MariaDB 10.2.15 (Linux Debian Stretch)



I have created a ~/.my.cnf config file in my home directory in order to set a default database at connection time for all local client tools:



[client]
user=myuser
password=mySecretPassword
database=mydb


But I want to unset (skip) option database for a specific client program (mysqldump). This is to prevent such warning when running mysqldump:



Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb'


I was hoping using skip-OPTIONNAME in a [mysqldump] section would have worked, but unfortunately it doesn't.



[client]
user=myuser
password=mySecretPassword
database=mydb

[mysqldump]
skip-database


In fact, I noticed that database is multi-value. So overriding it is not really possible. For example, the following .my.cnf config file:



[client]
user=myuser
password=mySecretPassword
database=mydb

[mysqldump]
database=mydb2


produces 2 warnings when running mysqldump:



Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb'
Warning: /usr/bin/mysqldump: ignoring option '--databases' due to
invalid value 'mydb2'


Is there a way to "unset" option database in an overridden section?







mariadb my.cnf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 29 '18 at 8:31









Nicolas PayartNicolas Payart

68531027




68531027





bumped to the homepage by Community 18 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 18 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Does it work/help to have a line database= in the 'mysqldump' section?

    – dbdemon
    Jun 30 '18 at 15:43











  • Thanks @dbdemon, I tried database= (empty value) but it does not help.

    – Nicolas Payart
    Jul 2 '18 at 8:09



















  • Does it work/help to have a line database= in the 'mysqldump' section?

    – dbdemon
    Jun 30 '18 at 15:43











  • Thanks @dbdemon, I tried database= (empty value) but it does not help.

    – Nicolas Payart
    Jul 2 '18 at 8:09

















Does it work/help to have a line database= in the 'mysqldump' section?

– dbdemon
Jun 30 '18 at 15:43





Does it work/help to have a line database= in the 'mysqldump' section?

– dbdemon
Jun 30 '18 at 15:43













Thanks @dbdemon, I tried database= (empty value) but it does not help.

– Nicolas Payart
Jul 2 '18 at 8:09





Thanks @dbdemon, I tried database= (empty value) but it does not help.

– Nicolas Payart
Jul 2 '18 at 8:09










1 Answer
1






active

oldest

votes


















0














In fact I am realizing that setting database option in a [client] section is may be nonsense as many client tools won't be compatible.



mysqldump and mysql_upgrade for example are complaining about this option. So I may specify it in a more specific [mysql] section instead:



[client]
user=myuser
password=mySecretPassword

[mysql]
database=mydb


Even if it meets my needs, It would still be great to find a way to override database option though...






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "182"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f210944%2foverride-database-option-in-a-user-specific-my-cnf-config-file%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In fact I am realizing that setting database option in a [client] section is may be nonsense as many client tools won't be compatible.



    mysqldump and mysql_upgrade for example are complaining about this option. So I may specify it in a more specific [mysql] section instead:



    [client]
    user=myuser
    password=mySecretPassword

    [mysql]
    database=mydb


    Even if it meets my needs, It would still be great to find a way to override database option though...






    share|improve this answer




























      0














      In fact I am realizing that setting database option in a [client] section is may be nonsense as many client tools won't be compatible.



      mysqldump and mysql_upgrade for example are complaining about this option. So I may specify it in a more specific [mysql] section instead:



      [client]
      user=myuser
      password=mySecretPassword

      [mysql]
      database=mydb


      Even if it meets my needs, It would still be great to find a way to override database option though...






      share|improve this answer


























        0












        0








        0







        In fact I am realizing that setting database option in a [client] section is may be nonsense as many client tools won't be compatible.



        mysqldump and mysql_upgrade for example are complaining about this option. So I may specify it in a more specific [mysql] section instead:



        [client]
        user=myuser
        password=mySecretPassword

        [mysql]
        database=mydb


        Even if it meets my needs, It would still be great to find a way to override database option though...






        share|improve this answer













        In fact I am realizing that setting database option in a [client] section is may be nonsense as many client tools won't be compatible.



        mysqldump and mysql_upgrade for example are complaining about this option. So I may specify it in a more specific [mysql] section instead:



        [client]
        user=myuser
        password=mySecretPassword

        [mysql]
        database=mydb


        Even if it meets my needs, It would still be great to find a way to override database option though...







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 2 '18 at 8:17









        Nicolas PayartNicolas Payart

        68531027




        68531027






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Database Administrators Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f210944%2foverride-database-option-in-a-user-specific-my-cnf-config-file%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            ف. موراي أبراهام

            صرب

            كأس إنترتوتو