Install MySQL Community 5.6.14 in Passive mode using batch file (on win7) - mysql

I'm trying to install MySQL Community 5.6.14 in Passive mode using a batch file.
First of all "MySQLInstaller" is unable to install MySQL in passive or quiet mode and user has to complete the installation wizard manually!
Does MySQL Community 5.6.14 support passive (or quiet) mode?!
Secondly, I have tested MySQLInstallerConsole examples but I couldn't find a correct combination of parameters !!!
Batch File Content:
#Echo off
echo Installing MysqlInstaller....
msiexec /i "c:\mysql\mysql.msi" /passive
cd C:\Program Files\MySQL\MySQL Installer
echo Config MysqlServer....
MySQLInstallerConsole --type=developer --action=install --product=* --config=mysql-server-5.6.14-win32:passwd=apassword
echo Finished !
pause

you can get the help by typing:
MySQLInstallerConsole.exe install
try this:
MySQLInstallerConsole.exe install server;5.6.17:*:port=3306;serverid=2:type=user;username=foo;password=bar;role=DBManager
I hope this will help.

Related

FreeBSD MySQL error after installation

I am on FreeBSD 10.2 32 bit and installed the newest version of mysql with the following command:
pkg install mysql57-server-5.7.12
Now, when I try to start mysql:
service mysql-server start
/usr/local/etc/rc.d/mysql-server: WARNING: failed precmd routine for mysql
I am getting this error. I hope you can help me.
Check your /var/db/mysql folder, if it contains files, make a backup and delete dir content:
rm -rf /var/db/mysql/*
Then do a data directory initialization:
/usr/local/libexec/mysqld --initialize --user=mysql
You should get a new temporary password, write it down, then start mysql-server
service mysql-server start
After mysql starts, secure the installation via:
/usr/local/bin/mysql_secure_installation
Open /etc/rc.conf and append or modify this line :
mysql_enable="YES"
Save the file, close it and retry to start the server.

Silent Installation of MySQL (version 5.7) on Windows with Batch Files

i'm trying to create a setup process for my C# application that use MySQL Database local (not online, every PC that will install my app, will get a clean Database to use). Searching around google i found that i need to make a "Silent" install of MySQL required components which are:
MySQL Server 5.7
MySQL Connector/Net
So I've done the following steps:
1) Downloading mysql-installer-community-5.7.11.0.msi from MySQL Home page
2) Made a Batch file "Setup.bat" that will create a Folder C:\MySQL and Copy there the Installer.msi and another batch file "Installer.bat".
3) After copying start Installer.bat with the command
Call C:\MySQL\Installer.bat
4) What Installer.bat will do:
#echo off
echo.
set password=admin
set installer="C:\Program Files (x86)\MySQL\MySQL Installer for Windows\MySQLInstallerConsole.exe"
set version=5.7.11
echo -----------------------
echo Details
echo -----------------------
echo Server User: root
echo.
echo Server Password: %password%
echo.
echo Configuration Folder: %installer%
echo.
echo Version: %version%
echo -----------------------
echo Start Installation... (si prega di attendere alcuni minuti)
echo.
msiexec /i "%~dp0\mysql-installer-community-%version%.0.msi" /qb
%installer% community install server;%version%;X64:*:port=3307;openfirewall=true;passwd=%password% -silent
pause
Installing the .msi file inside the folder,
Download and Install the MySQL server 5.7
and from here start my problem, the Download and Installation of MySQL server 5.7 go well, but once it need to configure with my parameters it start to initilazie the server with several steps:
Stopping Server [If Necessary]
Writing Configuration file
Updating Firewall
... and so on till i get this one
Starting Server
Once there it will never complete, so I checked Windows Event Viewer and i found that two errors occur once the " Starting Server " step begin:
Error1 Failed to create datadir C:\Program Files\MySQL\MySQL Server 5.7\data
Then
Error2 Aborting
If i try to install those components manually with the GUI installer i don't get any error and everything works good, but i need to make them install and configure automatically, can someone help me please? (Sorry about my english)

mysql connect could not find driver [duplicate]

I have just installed Debian Lenny with Apache, MySQL, and PHP and I am receiving a PDOException could not find driver.
This is the specific line of code it is referring to:
$dbh = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS)
DB_HOST, DB_NAME, DB_USER, and DB_PASS are constants that I have defined. It works fine on the production server (and on my previous Ubuntu Server setup).
Is this something to do with my PHP installation?
Searching the internet has not helped, all I get is experts-exchange and examples, but no solutions.
You need to have a module called pdo_mysql. Looking for following in phpinfo(),
pdo_mysql
PDO Driver for MySQL, client library version => 5.1.44
The dsn in your code reveals you are trying to connect with the mysql driver. Your error message indicates that this driver is unavailable.
Check that you have the mysql extension installed on your server.
In Ubuntu/Debian you check for the package with:
dpkg --get-selections | grep php | grep mysql
Install the php5-mysql package if you do not have it.
In Ubuntu/Debian you can use:
PHP5: sudo apt-get install php5-mysql
PHP7: sudo apt-get install php7.0-mysql
Lastly, to get it working, you will need to restart your web-server:
Apache: sudo /etc/init.d/apache2 restart
Nginx: sudo /etc/init.d/nginx restart
Update: newer versions should use php-sqlite3 package instead of php5-sqlite. So use this, if you are using a recent ubuntu version:
sudo apt-get install sqlite php-sqlite3
Original answer to question is here:
sudo apt-get install sqlite php5-sqlite
sudo /etc/init.d/apache2 restart
If your phpinfo() is not showing the pdo_sqlite line (in my case, on my Ubuntu Server), you just need to run the lines above and then you'll be good to go.
For newer versions of Ubuntu that have PHP 7.0 you can get the php-mysql package:
sudo apt-get install php-mysql
Then restart your server:
sudo service apache2 restart
I had the same issue. The solution depends on OS. In my case, i have debian, so to solve it:
Updated my php version from (php5 to php7)
Install php-mysql and php7.0-mysql
apt-get install php-mysql
apt-get install php7.0-mysql
I edited my php.ini locate at /etc/php/7.0/apache2/php.ini
uncomment the line : extension=php_pdo_mysql.dll
Then restart apache:
service apache2 restart
This solves my problem
On my Windows machine, I had to give the absolute path to the extension dir in my php.ini:
extension_dir = "c:\php5\ext"
Check if the module is available with php -m | grep pdo_mysql.
If not, for PHP 7.2, you can install relevant package with sudo apt install php7.2-mysql.
Use similar command on other PHP versions and package managers.
On Ubuntu just execute
sudo apt-get install php5-mysql
sudo apt-get install php-mysql
worked well on ubuntu and php 7
When adding these into your php.ini ensure the php_pdo.dll reference is first before the db drivers dlls otherwise this will also cause this error message too. Add them like this:
[PHP_PDO]
extension=php_pdo.dll
[PHP_PDO_MYSQL]
extension=php_pdo_mysql.dll
for Windows 8.1/10 in :\\php.ini file you should uncomment line "extension=pdo_mysql"
Did you check your php.ini (check for the correct location with phpinfo()) if MySQL and the driver is installed correctly?
For PHP 5.5 on CentOS I fixed this by installing the php55-mysqlnd package.
sudo yum -y install php55w-mysqlnd # For Webtatic
sudo yum -y install php55u-mysqlnd # For Remi
For help installing, write a comment as it depends on the way PHP is installed on your system. Available repo's are webtatic and remi.
Check if extension_dir in php configuration file set correctly. Try to comment/uncomment some extensions and see if it's reflected on phpinfo().
If it doesn't then either php config file cannot be loaded (wrong location) extension_dir is commented or set to the wrong location.
In my case my DSN string was incorrect, specifically it did not contain mysql://. I would have expected a different error message, perhaps something like 'DSN string does not specify driver/protocol.'
Adding mysql:// to the beginning of the DSN string resolved the issue.
I had the same problem during running tests with separate php.ini. I had to add these lines to my own php.ini file:
[PHP]
extension = mysqlnd.so
extension = pdo.so
extension = pdo_mysql.so
Notice: Exactly in this order
I spent the last day trying to figure out why I was getting the following error. I am running Ubuntu 14.04.
The Problem:
I noticed that my PHP-CLI version was running php7.0 but php_info() (the web version) was displaying php 5.5.9. Even though php_info() said pdo was enabled, using the command line (CLI) wasn't recognizing the pdo_mysql command. It turns out that mysql was enabled for my old version but not the CLI version. All I did was install mysql for php7.0 and it was able to work.
This is what worked:
To check the version:
php -v
To install mysql for php7.0
sudo apt-get install php7.0-mysql
1) make sure your CLI version is the same as your web version
2) If they are different, make sure your CLI version has the mysql plug-in since it doesn't come with it as a default.
Incorrect installation of PHP was being called
I was experiencing the same problem. And I hope this would help someone who is having a similar issue as me.
Scenario
OS = Windows 10
Platform = XAMPP
PHP Version = 7 (Multiple Version seem to have been installed in the PC)
I created phpinfo.php file in the public folder and run the phpinfo() to look for the location of my php.ini file.
PHP.ini Location = c:\xampp\php\php.ini
Problem
Calling c:\xampp\htdocs> php -v returned PHP 7.2.3 but phpinfo.php showed PHP 7.2.2.
Solution
Instead of calling
php artisan migrate:install
which gave me this error, I used
c:\xampp\php\php artisan migrate:install
and it worked.
The problem is a missing php to mysql library. In CentOs i fixed it by running
# yum install php-mysql and then restarting apache with # /bin/systemctl restart httpd.service Note that the naming is slightly different from debian/ubuntu based distros, php->php5 and httpd->apache2.
I extremely recommend mysqllnd instead of mysql because of you would have a lot of problems like number converting and bit type evaluates problem with mysql extension.
on ubuntu install mysqllnd with following command:
sudo apt-get install php5-mysqlnd
In my case, I was using PDO with php-cli, and it worked fine.
Only when I tried to connect from apache, I got the "missing driver" issue, which I didn't quite understand.
A simple apt-get install php-mysql solved it. (Ubuntu 16.04 / PHP7. credits go to the selected answer & Ivan's comment)
Hope it can help.
PHP Fatal error: Uncaught PDOException: could not find driver
I struggled and struggled with "apt install php-mysql php7toInfinity and don't forget sqlite-what-ever's" and just could not get rid of this error message until I went back to basics and reset the file-permissions on the web-site in question.
These 3 commands reset file and folder permissions on the web-site and got it to work again.
cd /var/www/web-site-name.com/web/
# find (sub) directories and change permissions
find . -type d -exec chmod 755 {} \;
# find files and change permissions
find . -type f -exec chmod 664 '{}' \;
I Fixed this issue on my Debian 6.
Normally I just had installed php5-common package. After installation, you have to restart your web server (apache or nginx depending on which one you installed).
Then I just do an lsof on the apache process id (lsof -p process_id) as followed :
sudo lsof -p 1399 #replace 1399 by your apache process id
apache2 1399 root mem REG 254,2 80352 227236 /usr/lib/php5/20090626/xmlrpc.so
apache2 1399 root mem REG 254,2 166496 227235 /usr/lib/php5/20090626/suhosin.so
apache2 1399 root mem REG 254,2 31120 227233 /usr/lib/php5/20090626/pdo_mysql.so
apache2 1399 root mem REG 254,2 100776 227216 /usr/lib/php5/20090626/pdo.so
apache2 1399 root mem REG 254,2 135864 227232 /usr/lib/php5/20090626/mysqli.so
As you can see above, the modules are installed on a file path not known or guided by common library path: /usr/lib/php5/20090626/. For your installation, it may be different, but only the path of pdo_mysql.so, pdo.so, mysqli.so. So, this is why Drupal or any other php engine couldn't find the library and shows that error: PDOException: could not find driver
I just don't know why it is installed on such a weird path, for me it's just a bug in the library package installation script in debian 6.
I solved the issue by creating a symbolic for all the files under /usr/lib/php5/20090626/ to
/usr/lib/php5/ with this command :
ln -s /usr/lib/php5/20090626/* /usr/lib/php5/
$DB_TYPE = 'mysql'; //Type of database<br>
$DB_HOST = 'localhost'; //Host name<br>
$DB_USER = 'root'; //Host Username<br>
$DB_PASS = ''; //Host Password<br>
$DB_NAME = 'database_name'; //Database name<br><br>
$dbh = new PDO("$DB_TYPE:host=$DB_HOST; dbname=$DB_NAME;", $DB_USER, $DB_PASS); // PDO Connection
This worked for me.
I faced the same issue after I removed the php5 package (that includes all the drivers as well) in order to install php7 package. I actually installed php7 package without a mysql module.
I managed to solve it by typing in the terminal:
1) $ apt-cache search php7
which lists all the modules, looking through the modules I found,
php7.0-mysql - MySQL module for PHP
2) $ sudo apt-get install php7.0-mysql
That's it. It worked for me in my linux system.
(use the appropriate php version, yours could be php5)
Just one other thing to confirm as some people are copy/pasting example code from the Internet to get started. Make sure you have MySQL entered here:
... $dbh = new PDO ("mysql: ...
In some examples this shows
$dbh = new PDO ("dblib ...
For those using Symfony2/3 and wondering why you're getting this error. If you're using "mapping_types", you might encounter this error. The reason is that "mapping_types" is placed at the wrong level. For instance :
doctrine:
dbal:
mapping_types:
set: string
This "mapping_types" must be placed at this level :
doctrine:
dbal:
#To counter the error caused by 'mapping_types'
connections:
default:
server_version: %database_server_version%
mapping_types:
set: string
I hope this helps
I found the solution here : https://github.com/doctrine/DoctrineBundle/issues/327
Everywhere I go I read that the path of extension_dir should be changed from ext to an absolute path. It worked for me. However, when trying to build a server of my colleague's PC, I had to let the value to ext instead of putting an absolute path.
If you did put an absolute path and it does the extension is still not found, considerer trying both with the absolute path and ext.
Check correct path in extension_dir in you phpinfo().
Had the same issue, because I forgot to go into my virtual machine. If I go to my local directory like this:
cd /www/homestead/my_project
php artisan migrate
that error will appear. But it works on my virtual machine
cd ~/homestead
vagrant ssh
cd /www/homestead/my_project
php artisan migrate

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.

Getting MySQL working on OSX 10.7 Lion

I'm currently trying to get MySQL working on OSX 10.7 Lion. I tried the brew way:
brew install mysql
-> cmake -> no problems
-> make -> no problems
-> make install -> no problems
-> done
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
Installing MySQL system tables...
/usr/local/bin/mysql_install_db: line 428: 15397 Done { echo "use mysql;"; cat $create_system_tables $fill_system_tables; }
15398 Done(141) | eval "$filter_cmd_line"
15401 Segmentation fault: 11 | $mysqld_install_cmd_line > /dev/null
Installation of system tables failed! Examine the logs in
/usr/local/var/mysql for more information.
Did anyone get mysql to run on Lion?
You can download a MySQL installer as a DMG file, complete with an installer, system preferences pane and a startup script directly from MySQL. Go to MySQL's community server download page, select Mac OS X as the platform and pick the DMG file.
You can skip the registration form (there a little link under the signup form) and you should be on your way.
Once the file is downloaded, double-click on the DMG, launch the installer and complete the installation. After that, install the startup script using its installer and finally the preferences pane by double-clicking on it. I highly recommend choosing to install it for all users on the computer.
You'll find this way much easier than compiling from source.
You should check out Sequel Pro if you need a great OS X tool to manage your MySQL databases.
A drop in replacement for mysql is mariadb. You can install with 'brew install mariadb'. It builds on Lion.
Existing mysql drivers and clients just work. I'm using it with python-mysql and django.
It's even called mysql so you won't even know the difference.
Ha! Got it!
First... download mysql-5.6.2 here: http://dev.mysql.com/downloads/mirror.php?id=402349#mirrors ... once finished, untar the file and do this:
mv path/to/mysql-5.6.2-m5-osx10.6-x86_64 /usr/local/mysql
echo "PATH=\$PATH:/usr/local/mysql/bin" >> ~/.profile
# open a new tab
cd /usr/local/mysql #this is essential!
./scripts/mysql_install_db
mysqld_safe &
mysql -uroot
works for me :)
You need to set up your path environment too, and it's also good practise to set a root password while you're at it. I've created a full step-by-step here: How to install MySQL on Lion (Mac OS X )
All,
I was having issues with connecting to my DB through Tomcat, yet could through the MySql tool. Tomcat was accessing it through the actual IP of my machine (10.0.x.x) instead of through localhost or 127.0.0.1. Turns out that when I migrated from SL to Lion, remote connections were disabled. Once I enabled them, it worked fine.
Hopefully this helps someone.
I had MySQL installed already, but after upgrading to Lion it would no longer start.
I tried installing the latest official version and it still wouldn't start.
Finally, this fixed it:
$ sudo mkdir /var/log/mysql
$ sudo chown mysql:mysql /var/log/mysql