How to install mysql on ubuntu with SaltStack - mysql

I have to write a SLS file to install mysql-server, mysql-client, mysql-common on ubuntu. How do I do it? The following SLS is giving error saying that these packages are unbale to install or update.
state1:
pkg.installed:
- pkgs:
- mysql-server
- mysql-common
- mysql-client

I experienced an issue with mysql-server specifically. On Ubuntu, it's a "meta-package" which just installs the latest version, e.g. mysql-server-5.5. In my case, there was an error with my preconfiguration, and apt marked "mysql-server" as installed, but "mysql-server-5.5" failed. Later calls to apt failed because of the missing "mysql-server-5.5". I removed mysql-server manually, fixed my issue with the preconfiguration, and it worked fine. Here's my code, for your reference:
mysql_setup:
debconf.set:
- name: mysql-server
- data:
'mysql-server/root_password': {'type': 'string', 'value': '{{ pillar['SQL_ROOT_PASSWORD'] }}'}
'mysql-server/root_password_again': {'type': 'string', 'value': '{{ pillar['SQL_ROOT_PASSWORD'] }}'}
mysql-server:
pkg:
- installed
- require:
- debconf: mysql_setup

That isn't how the pkg.installed directive works. You want this:
mysql-server:
pkg.installed
mysql-common
pkg.installed
mysql-client
pkg.installed

Related

dpkg: error processing package nginx (--configure)

When I try to install nginx the error comes like:
dpkg: error processing package nginx (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-common
libmysqlclient21:amd64
nginx-full
mysql-community-server
libmysqlclient-dev
mysql-server
mysql-community-client
mysql-client
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried a lot of solution but not solve my problem,this one of them:
sudo dpkg ––configure –a
but it's show this error
Errors were encountered while processing:
mysql-common
libmysqlclient21:amd64
mysql-community-server
libmysqlclient-dev
mysql-server
mysql-community-client
mysql-client
Any ideas?
I fixed the problem,
nginx fix:
the problem is because of the apache2 service, I just stopped the apache2 service after that installed nginx.
sudo service apache2 stop
sudo install nginx
fix sub process error code (1):
I used the sips in this link And it's worked for me.

Install mysql-5.7 with ansible on ubuntu 14.04 trusty

I'm trying to install Mysql-5.7 on ubuntu 14.04 which by default has no has no 5.7 package in its repositories.
So I try to add it manually with this little role:
---
- name: download the mysql deb package
get_url: url=http://dev.mysql.com/get/{{ deb_filename }} dest=/tmp/{{ deb_filename }} mode=0644
tags: apt
- name: install the package
sudo: true
apt: deb=/tmp/{{ deb_filename }}
tags: apt
- name: update apt cache
sudo: true
apt: update_cache=yes
tags: apt
Where deb_filename is the latest one “mysql-apt-config_0.8.7-1_all.deb”.
When I run a playbook with this role everything seems to run smoothly. No errors.
But then when it comes to a real installation of a package it says that:
msg: No package matching 'mysql-client-5.7' is available
And when I login to the server and run “apt-cache search mysql-client” I see no mysql-5.7.
How can I add this package using ansible to my server?
Thanks everyone!

Mysql installation on ubuntu 16.04

I am installing mysql on Ubuntu 16
when I use :
sudo apt-get install mysql-server mysql-client
it gives me :
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-client is already the newest version (5.7.18-1ubuntu16.04).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
mysql-client : Depends: mysql-community-client (= 5.7.18-1ubuntu16.04) but it is not going to be installed
mysql-server : Depends: mysql-community-server (= 5.7.18-1ubuntu16.04) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
how do I resolve this issue.

Ansible not installing latest version of Mysql 5.7

My Ansible script is installing Mysql version 5.4, but I need it to install 5.7.
This is the code:
- name: mysql | Install MySQL Packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items:
- mysql-server
- mysql-client
- python-mysqldb
I have tried this, but it doesn't work:
- name: mysql | Install MySQL Packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items:
- mysql-server-5.7
- mysql-client-5.7
- python-mysqldb
Anyone know how to get Ansible to install Mysql 5.7?
I would expect 5.4 is the latest version available per apt. Unless you're saying you can install MySQL 5.7 with apt manually on the command line, this is not an Ansible issue.
You can try to activate the update_cache option.
- name: mysql | Install MySQL Packages
sudo: yes
apt:
pkg: "{{ item }}"
state: latest
update_cache: yes
with_items:
- mysql-server
- mysql-client
- python-mysqldb
Also you could try to add the MySQL apt repository with the apt_repository module before installing MySQL. Something like this:
- apt_repository:
repo: 'deb http://repo.mysql.com/apt/debian/ precise mysql-5.7'
state: present

Can't find nor install mysql_config

I get this error from Inspircd
Can't exec "mysql_config": No such file or directory at /home/alpha/inspircd-2.0.19/make/utilities.pm line 392, <FLAGS> line 37.
Make sure you have pkg-config installed
In the case of gnutls configuration errors on debian,
Ubuntu, etc, you should ensure that you have installed
gnutls-bin as well as libgnutls-dev and libgnutls.
I've been looking all over the internet trying to find out how to remove the errors.
I have read multiple threads but no luck. I know I need the libmysqlclient-dev package but I can't for the life of me get it installed.
I run
sudo apt-get install libmysqlclient-dev
Also tried cleaning, "-f" and so on but I still get the error.
The following packages have unmet dependencies:
libmysqlclient-dev : Depends: libmysqlclient18 (= 5.5.40-0ubuntu1) but 5.5.41-0ubuntu0.14.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.
I tried it with aptitude
sudo aptitude install libmysqlclient-dev
then I downgraded libmysqlclient18 one version and now it works as it should.
you tried remove all PPA ( Personal Package Archive )?
before try:
sudo apt-get autoremove && sudo aptitude update && sudo aptitude install libmysqlclient-dev
I see in Bugtrack MYSQL:
https://goo.gl/34NUgo
your ERROR is Bug know Bug #73522 Installation of libmysqlclient-dev fails if libmysqlclient18 is from percona
still unsolved:
status: Unsupported
environment: Ubuntu 14.04 LTS; Kernel 3.13, MySql 5.6
att
Have you tried tu upgrade your libmysqlclient18 packet ? (Perform an apt-get update before, just in case ...)