How to install MySQL 5.6 in Ubuntu 18.04(VM) - mysql

I'm using packer to install MySQL 5.6 on an Ubuntu VM. To install it, I'm using the below script.
#!/bin/bash
sudo add-apt-repository 'deb http://kr.archive.ubuntu.com/ubuntu xenial main' -y
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe' -y
sudo apt-get update -y
sudo apt-get install mysql-server-5.6 -y
systemctl restart mysql
However, the installer kept prompting for a password. Is there any way to pass the password in the script since it's installed within a VM? I'm stuck in this situation.
error-screenshot

Related

Why is mysql asking for password after default installation as root

I see this when I ssh to my Ubuntu server:
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-1018-aws x86_64)
After installing mysql, I try to login to the mysql server but for some reason it asks me for a password that I do not have. So, I ran the following commands to uninstall mysql and reinstall.
Uninstall
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysql
sudo apt-get dist-upgrade
The I used this link as guide to install mysql, and the commands went as follows:
sudo apt update
sudo apt install mysql-server
sudo systemctl start mysql.service
When I run:
sudo mysql_secure_installation
The prompt asks me to “Enter password for the user root”. Where do I find this password?
The idea of the command is to set the password.
How can I install mysql in this server to then be able to manage my databases?

Cant install MySQL Becouse no Root Permissions?

Hello I want to Install MySQL to my Vserver, I created a New user, but I cant Install MySQL becouse I have no root permissions for the user
What can I do now?
Linux - Debian 9
apt-get install apache2 php libapache2-mod-php
apt-get install mysql-server mysql-client php-mysql
apt-get install phpmyadmin
/etc/init.d/apache2 restart
echo Include /etc/phpmyadmin/apache.conf /etc/apache2/apache2.conf
/etc/init.d/apache2 restart
Just substitute with sudo:
sudo su
apt-get install apache2 php libapache2-mod-php
apt-get install mysql-server mysql-client php-mysql
apt-get install phpmyadmin
/etc/init.d/apache2 restart
echo Include /etc/phpmyadmin/apache.conf /etc/apache2/apache2.conf
/etc/init.d/apache2 restart

how to kill process holding the apt lock

I'm updating apt and installing mysql-client at run time to a ubuntu 18.04 aws instance.
My shell command are like,
- apt-get update
- apt-get install -y mysql-client
- apt-get install -y unzip
But 'apt-get install -y mysql-client' hang and lock apt. Therefor 'apt-get install -y unzip' get fail. So to proceed this, I have to manually kill the process and unclock the apt from following commands.
Step 01. ps -ef | grep apt
Step 02. kill -9
Step 03. sudo dpkg --configure -a
Step 04. Yes the below message
restarts will be done for you automatically so you can avoid being asked questions on each library upgrade. │ Restart services during package upgrades without asking?
Step 05. apt-get install -y mysql-client
My question is how I implement following from shell script or is there a any way to install mysql-client at run time?
Try to set DEBIAN_FRONTEND=noninteractive and the -q parameter to avoid apt from opening interactive prompts.
e.g:
DEBIAN_FRONTEND=noninteractive apt-get install -yq mysql-client

mysql server connection setup with phpmyadmin

I installed mysql-server on Debian. And also installed lampp on Debian. But in order to run lampp and properly working of phpmyadmin I have to stop my mysql-server running on Debian. This creates two different mysql servers. One belonging to phpmyadmin and one belonging to mysql running locally. Is there any way, so that both phpmyadmin and mysql-server run on same port?
You cant run both mysql servers on same port. The best way is to remove Both MySql and Lamp stack then reinstalling it again.
1.)remove mysql and lamp stack:-
sudo apt-get remove --purge mysql-server.* apache2* php* phpmyadmin*
sudo apt-get auto-remove
2.)install lamp stack
sudo apt-get update
sudo apt-get install
sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install php5 php-pear php5-mysql
sudo service apache2 restart
sudo apt-get install phpmyadmin
then you are ready to code!

Installing ansible 2.6 or older

With 2.6.2, ansible started ignoring config files in world writable dirs, rendering many windows/vagrant setups useless. I try to install Ansible 2.6 or older.
System:
Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-132-generic x86_64)
The propvision.sh states
# Add Ansible Repository & Install Ansible
sudo add-apt-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible && sudo touch /root/ansible_ready
I adapted it to
sudo apt-get install -y ansible=2.6.0 && sudo touch /root/ansible_ready
^^^^^^
but that version was not found. How can I obtain 2.5 or 2.6? I am quite unexperienced with linux and the concept of installing something not by a doubleclick.
For installation of Ansible version 2.6 on Trusty Tahr 14.04 (LTS), proceed with the follow commands:
sudo apt update
sudo apt install -y software-properties-common
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
Add apt source list:
sudo tee -a /etc/apt/sources.list.d/ansible-2.6.list << EOF
deb http://ppa.launchpad.net/ansible/ansible-2.6/ubuntu trusty main
deb-src http://ppa.launchpad.net/ansible/ansible-2.6/ubuntu trusty main
EOF
Update apt and install Ansible:
sudo apt update
sudo apt install -y ansible