- Richard Feynman -
Difference between revisions of "Mariadb on cygwin"
(→Procedure) |
(→Preparations) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | = | + | = MariaDB client = |
+ | |||
+ | == Preparations == | ||
+ | |||
+ | # Start a [[cygwin]] terminal (running [[bash]]). | ||
+ | |||
+ | Launch the [[cygwin]] setup program and install the package <code>mysql</code>. | ||
+ | |||
+ | == Using MariaDB client == | ||
+ | |||
+ | [[File:Mysql-mamp.png|thumb|400px|MariaDB client connecting to MySQL]] | ||
+ | To connect to Mamp's MySQL: | ||
+ | <source lang="bash"> | ||
+ | mysql -p -u root -h 127.0.0.1 | ||
+ | </source> | ||
+ | |||
+ | If you want the command to be non-interactive you can supply the password on the command line. It is important to understand that this is not a secure solution: | ||
+ | <source lang="bash"> | ||
+ | mysql -p -u root -h 127.0.0.1 --password="password" | ||
+ | </source> | ||
+ | ''Note: in the command line above we assume your password is "password"'' | ||
+ | |||
+ | If you want to take this one step further you can write a bash function: | ||
+ | <source lang="bash"> | ||
+ | mysqlc() { echo "$*" | mysql -p -u root -h 127.0.0.1 --password="password" ; } | ||
+ | </source> | ||
+ | |||
+ | With the function above you can execute SQL commands like this: | ||
+ | <source lang="bash"> | ||
+ | mysqlc "SELECT * FROM members" | ||
+ | </source> | ||
+ | |||
+ | = MariaDB Server = | ||
== Preparations == | == Preparations == | ||
− | |||
# Start a [[cygwin]] terminal (running [[bash]]). | # Start a [[cygwin]] terminal (running [[bash]]). | ||
== Procedure == | == Procedure == | ||
− | + | Launch the [[cygwin]] setup program and install the package <code>mysqld</code>. Now we need to install the MariaDB software with the following command. | |
<source lang="bash"> | <source lang="bash"> | ||
mysql_install_db | mysql_install_db | ||
</source> | </source> | ||
+ | ''Note: This command may take some minutes to complete.'' | ||
Now, we start the MariaDB server. | Now, we start the MariaDB server. | ||
Line 18: | Line 50: | ||
mysqld_safe & | mysqld_safe & | ||
</source> | </source> | ||
− | |||
''Note: You might get a firewall notice if the firewall is up and running!'' | ''Note: You might get a firewall notice if the firewall is up and running!'' | ||
Latest revision as of 13:36, 27 June 2017
Contents
MariaDB client
Preparations
Launch the cygwin setup program and install the package mysql
.
Using MariaDB client
To connect to Mamp's MySQL:
mysql -p -u root -h 127.0.0.1
If you want the command to be non-interactive you can supply the password on the command line. It is important to understand that this is not a secure solution:
mysql -p -u root -h 127.0.0.1 --password="password"
Note: in the command line above we assume your password is "password"
If you want to take this one step further you can write a bash function:
mysqlc() { echo "$*" | mysql -p -u root -h 127.0.0.1 --password="password" ; }
With the function above you can execute SQL commands like this:
mysqlc "SELECT * FROM members"
MariaDB Server
Preparations
Procedure
Launch the cygwin setup program and install the package mysqld
. Now we need to install the MariaDB software with the following command.
mysql_install_db
Note: This command may take some minutes to complete.
Now, we start the MariaDB server.
mysqld_safe &
Note: You might get a firewall notice if the firewall is up and running!
To finish things off we secure the installation:
mysql_secure_installation
When this script is executing you will get a couple of questions.
aslklasdj