Silent installation of MySql as Service - mysql

i need to install MySql Server in silent mode on Windows.
I run the following command for installing the server:
MySQLInstallerConsole.exe --action=install --catalog=mysql-5.6-winx64 --type=developer --product=* --config=mysql-server-5.6-winx64:passwd=MyPassword;openfirewall=true;autostartservice=true
This install the server correctly but do not install any service.
How can I install the MySql as service from command line?
Thanks you very much

Have you tried:
C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe" --install

Related

How can I set the my.ini location at install time

I have an application with a NSIS installer, it installs my application and also mysql 5.7.25.
When installing it create a my.ini inside :
C:\ProgramData\MySQL\MySQL Server 5.7
The problem is that one of my client has another application which run with mysql 5.7.20. which also has a my.ini in the same place. So my installer overwrite the existing file and break the other app.
When installing how can I tell the installer where the my.ini is ?
My idea is to put it inside my application folder and tell mysql to look here:
C:\ProgramData\MyAPP
I am installing mysql like that (in 2 steps):
I install the installer :
"msiexec" /quiet /norestart /i
"C:\MYAPP\Mysql\mysql-installer-community-5.7.25.0.msi"
INSTALLDIR="C:\Program Files\MySQL\MySQL Server 5.7"
then mysql
"C:\Program Files (x86)\MySQL\MySQL Installer for
Windows\MySQLInstallerConsole.exe" community install -silent
server;5.7.25;x64:*:port=3306;passwd=root;installdir="C:\Program
Files\MySQL\MySQL Server 5.7"
Thanks
Ok I found the solution :
I believed that mysql installation was creating the service. But I was wrong the windows service is created later in my installer :
'"$1\bin\mysqld.exe" --install ${MYSQL_SERVICE_64}'
So can add the argument "--defaults-file" here and place the .ini where ever I want.

MySql Service not starting

I was having mysql 5.1.x installed on my windows machine. Beacuse of some reason I needed 5.5.x or above. I uninstalled mysql 5.1.x and downloaded the 5.7.x version. I extracted and tried to install the service using below command and I got the response saying Service already exists. How to fix the issue?
C:\mysql-5.7.10\bin>mysqld --install
The service already exists!
The current server installed: "C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\mysqld" --defaults-file="C:\Program Files (x86)\MySQL\MySQL Server 5.1\my.ini" MySQL
You must run the command sc delete {{MySQL}} where {{MySQL}} is the name of the service.

How do I install command line MySQL client on mac?

I want to install the MySQL client for the command line, not a GUI. I have searched over the web but only found instructions on installing the MySQL server.
install MySQLWorkbench, then
export PATH=$PATH:/Applications/MySQLWorkbench.app/Contents/MacOS
This strictly installs a command line client, without the other overhead:
Install Homebrew (if you don't have it):
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then, install mysql-client:
brew install mysql-client
Then, add the mysql-client binary directory to your PATH:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
Finally, reload your bash profile:
source ~/.bash_profile
Then you should be able to run mysql in a terminal, if not try opening a new terminal
If you have already installed MySQL from the disk image (dmg) from http://dev.mysql.com/downloads/), open a terminal, run:
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
then, reload .bash_profile by running following command:
. ~/.bash_profile
You can now use mysql to connect to any mysql server:
mysql -h xxx.xxx.xxx.xxx -u username -p
Credit & Reference: http://www.gigoblog.com/2011/03/13/add-mysql-to-terminal-shell-in-mac-os-x/
Best option is:
brew install mysql
Mysql has a client-only set of utilities:
Mysql client shell
https://dev.mysql.com/downloads/shell/
Other command line utilities
https://dev.mysql.com/downloads/utilities/
Mac OSX version available.
There is now a mysql-client formula.
brew install mysql-client
For installing mysql-shell with homebrew, run
brew cask install mysql-shell
you can then launch the mysql shell with
mysqlsh
if you want to enter SQL mode directly, run
mysqlsh --sql
Open the "MySQL Workbench" DMG file and
# Adjust the path to the version of MySQL Workbench you downloaded
cp "/Volumes/MySQL Workbench 6.3.9.CE/MySQLWorkbench.app/Contents/MacOS/mysql" /usr/local/bin
# Make sure it's executable
chmod +x /usr/local/bin/mysql
Eject the DMG disk
Installation command from brew:
$ brew cask install mysql-shell
Look at what you can do:
$ mysqlsh --help
Run query from mysqlsh client installed:
$ mysqlsh --host=192.x.x.x --port=3306 --user=user --password=xxxxx
MySQL Shell 8.0.18
Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.
Type '\help' or '\?' for help; '\quit' to exit.
WARNING: Using a password on the command line interface can be insecure.
Creating a session to 'user#192.x.x.x:3306'
Fetching schema names for autocompletion... Press ^C to stop.
Your MySQL connection id is 16
Server version: 8.0.18 MySQL Community Server - GPL
No default schema selected;
type \use <schema> to set one.
MySQL 192.x.x.x:3306 ssl JS >
MySQL 192.x.x.x:3306 ssl JS > `\use rafdb`
Default schema set to `rafdb`.
If you installed from the DMG on a mac, it created a mysql client but did not put it in your user path.
Add this to your .bash_profile:
export PATH="/usr/local/mysql/bin:$PATH
This will let you run mysql from anywhere as you.
As stated by the earlier answer you can get both mysql server and client libs by running
brew install mysql.
There is also client only installation. To install only client libraries run
brew install mysql-connector-c
In order to run these commands, you need homebrew package manager in your mac. You can install it by running
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Using MacPorts you can install the client with:
sudo port install mysql57
You also need to select the installed version as your mysql
sudo port select mysql mysql57
The server is only installed if you append -server to the package name (e.g. mysql57-server)
The easiest way would be to install mysql server or workbench, copy the mysql client somewhere, update your path settings and then delete whatever you installed to get the executable in the first place.
The mysql client is available in macOS ports. If you don't have this excellent third party package manager already installed, it is available from here: https://www.macports.org/
Once you have installed macports, open a terminal and make sure everything is up to date:
sudo port selfupdate
There are multiple different versions of MySQL and mariadb (community fork of MySQL) available in the ports repos. List available versions using the following command:
port search 'mariadb*'
I recommend choosing mariadb over mysql as it is, mostly, a drop in replacement (https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility/) and has excellent community support.
If applicable, choose which version of mariadb you want (a list of versions of mariadb is available here: https://downloads.mariadb.org/mariadb/+releases/). If you're not bothered, install the default version:
sudo port install mariadb
Mariadb (including the mysql-compatible command line client) is now available on your system. On my system, the CLI client resides in the following location:
$ /opt/local/bin/mysql --version
/opt/local/bin/mysql Ver 15.1 Distrib 5.5.68-MariaDB, for osx10.15 (x86_64) using readline 5.1
It's obviously a bit inconvenient to type out the full path, /opt/local/bin/mysql each time you want to use the client. Ports has already thought of this problem. To view available versions of mysql on your system, run:
$ port select mysql
Available versions for mysql:
mariadb (active)
none
Choose one from the list. For example, to use mariadb as the default mysql client:
sudo port select mysql mariadb
Now open a fresh terminal window and you should be able to start the mariadb mysql CLI client:
mysql -h <hostname> -u <username> -p
if you need a lighter solution i recommend mysql-shell, install using the command below.
brew cask install mysql-shell
To start after installation type mysqlsh.

Percona 5.6 on amazon linux ami failing

Amazon linux AMI and Percona server 5.6 don't appear to be compatible right out of the box. MySQL won't start after successful install.
In Perconas docs it does say that it is supported.
Steps to get to the below:
yum install http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
yum install Percona-Server-server-56
Which installs the client + shared 56 libraries as well.
Some more accurate logs.
[root#* ec2-user]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root#* ec2-user]# service mysql restart
ERROR! MySQL (Percona Server) PID file could not be found!
Starting MySQL (Percona Server).......... ERROR! The server quit without updating PID file (/var/lib/mysql/ip-172-30-0-92.pid).
On the most recent Amazon Linux AMI, I was able to start the server after running these commands:
yum install 'perl(Data::Dumper)'
yum reinstall Percona-Server-server-56
If the perl-Data-Dumper package is not installed, mysql_install_db fails to run and perform the initial setup.
The Percona-Server-server-56 package should declare a dependency on perl-Data-Dumper, but you can work around that error (and avoid the reinstall) by installing it first.

MySQL said: 2002 - No connection could be made because the target machine actively refused it

Also the error message in xampp control panel states:
Found Path: "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.5\my.ini" MySQL
20:08:20 [mysql]
Expected Path: c:\xampp\mysql\bin\mysqld.exe --defaults-file=c:\xampp\mysql\bin\my.ini mysql
Can you help as this is a fresh install of xampp v.3.2.1
I followed the instructions on install I don't know why it's not working.
Do I need to change the path in the httpd.conf file in mysql for it to find the path?
It looks mysql is already installed in your system in the above mentioned "Found Path". If already installed mysql is not needed, uninstall it. Now try to run our new Xampp mysql server, it will run. Otherwise you can run the xampp mysql using "mysql_start" batch file which is under XAMPP folder.