Hi!

I would like to install MySQL Server along with my Python application on Windows and Mac. If not installed, a default username and password is used. However, if the MySQL is installed already, I would like to get the root username and password and pass it to my Python script or create the default user with privileges my script is using. How do I do it?

asked 22 Mar '16, 19:26

roomi's gravatar image

roomi
1334
accept rate: 0%

edited 22 Mar '16, 19:27


Hi roomi,

You can use the parameterString to ask for the username and password, and using a validationActionList to check the username and password provided with are correct. Find below how to achieve that:

<parameterList>
    <parameterGroup>
        <name>mysql</name>
        <explanation></explanation>
        <value></value>
        <default></default>
        <parameterList>
            <stringParameter>
                <name>username</name>
                <description>Username</description>
                <explanation></explanation>
                <value></value>
                <default></default>
                <allowEmptyValue>0</allowEmptyValue>
            </stringParameter>
            <stringParameter>
                <name>password</name>
                <description>Password</description>
                <explanation></explanation>
                <value></value>
                <default></default>
                <allowEmptyValue>0</allowEmptyValue>
            </stringParameter>
            <stringParameter>
                <name>host</name>
                <description>Host</description>
                <explanation></explanation>
                <value></value>
                <default></default>
                <allowEmptyValue>0</allowEmptyValue>
            </stringParameter>
        </parameterList>
        <validationActionList>
            <runProgram>
                <customErrorMessage>Cannot connect to MySQL Server</customErrorMessage>
                <program>/path/to/mysql</program>
                <programArguments>-h ${host} -u${root} -p${password} -e ";"</programArguments>
            </runProgram>
        </validationActionList>
    </parameterGroup>
</parameterList>
link

answered 23 Mar '16, 05:47

jesus's gravatar image

jesus ♦♦
1.1k14
accept rate: 18%

Thank you for your reply jesus. I got your point about getting credentials and testing if it works with the installed MySQL server. However, Is there a way to check if an installation of MySQL server exists?, so that we can skip asking for credentials and proceed to install it directly?

(23 Mar '16, 12:03) roomi
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×176
×130
×10
×5

Asked: 22 Mar '16, 19:26

Seen: 507 times

Last updated: 23 Mar '16, 12:03