how can I install mysql without errors? - mysql

This installation of MySQL is already upgraded to 5.7.40, use --force if you still need to run mysql_upgrade
dpkg: error processing package mysql-server-5.7 (--configure):
installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)
what should I do here ??
i tried these cmds and still the error appears:
sudo apt-get clean
sudo apt-get purge mysql*
sudo apt-get update
sudo apt-get install -f
sudo apt-get install mysql-server-5.7
sudo apt-get dist-upgrade

Try something like this. This helped me:
sudo service mysql stop
sudo apt-get --purge remove mysql*
sudo rm -rf /etc/mysql/
Then I reinstalled it:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mariadb-server
sudo service mysql start
sudo mysql -u root -p
secret
sudo mysql -u root -p
GRANT ALL PRIVILEGES on *.* to 'root'#'localhost' IDENTIFIED BY '<password>';
FLUSH PRIVILEGES;

Related

Unable to set password error while Mysql Data Migration

I am trying to migrate mysql databases from one server to another. I am following these steps for the migration (270GB of data including databases and users in datadir):
sudo service mysql stop
sudo apt-get purge mysql-server-5.5 mysql-common
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo ln -s <path to datadir>/mysql /var/lib/mysql
sudo apt-get clean
sudo apt-get purge mysql*
sudo apt-get update
sudo apt-get install -f
sudo apt-get install mysql-server-5.5
This asks for root password, which I try to set accordingly. However, I am getting the following response:
Configuring mysql-server-5.5
Unable to set password for the MySQL "root" user
An error occurred while setting the password for the MySQL administrative
user. This may have happened because the account already has a password, or
because of a communication problem with the MySQL server.
You should check the account's password after the package installation.
Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more
information.
Note that I followed the same steps on another ubuntu server (dev) based on the same AMI and was successful in doing the setup. The only variable between the two is data.
I cannot afford much downtime, and therefore using rsync for data replication.
I know that both the ubuntu and mysql versions are old, but this migration is necessary and has strict deadlines.
The solution here was pretty simple.
Rebooting the ubuntu server after following the steps to purge mysql* worked for me. Steps:
sudo service mysql stop
sudo apt-get purge mysql-server-5.5 mysql-common
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo ln -s <path to datadir>/mysql /var/lib/mysql
sudo apt-get clean
sudo apt-get purge mysql*
Reboot the ubuntu machine.
Then:
sudo apt-get update
sudo apt-get install -f
sudo apt-get install mysql-server-5.5

cannot open /usr/share/dbconfig-common/internal/mysql: No such file

Good afternoon all. Iḿ having this problem in a debian OS
Setting up phpmyadmin (4:4.9.7+dfsg1-1) ...
/var/lib/dpkg/info/phpmyadmin.config: 144: .: cannot open /usr/share/dbconfig-common/internal/mysql: No such file
dpkg: error processing package phpmyadmin (--configure):
installed phpmyadmin package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
phpmyadmin
Already tryied to force, and already reinstaled mysql and mysql is running, but phpmyadmin doens´t work.
sudo apt-get clean
sudo apt-get update
sudo dpkg -r mysql-client-5.7
sudo dpkg -r mysql-server-5.7
sudo dpkg -r libmysqlclient20:i386
sudo dpkg -r libmysqlclient20:amd64
sudo dpkg -r libmysqlclient18:amd64
sudo dpkg -r mysql-common
sudo dpkg -r mysql
apt upgrade and aptitude --fix-missing and nothing worked
Thanks
That file is provided by dbconfig-common, so while I have no idea why it's missing in the first place, you should be able to fix it with apt-get install --reinstall dbconfig-common.

mysql-server-5.7 is not configured yet

I installed Mysql5.7 long time ago, afterwards I uninstalled it and installed MariaDB disabling apparmor (mysql) profile.
Now I uninstalled MariaDB and I'm trying to install mysql5.7 and I got this error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version (5.7.28-0ubuntu0.18.04.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up mysql-server-5.7 (5.7.28-0ubuntu0.18.04.4) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 191: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
installed mysql-server-5.7 package post-installation script subprocess returned error exit status 127
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
I get this error when I use sudo dpkg --configre -a too.
I install the package using sudo apt install mysql-server.
I tried to follow some guide online, I removed /var/lib/dpkg/info/mysql-server-5.7.postinst purged mariadb, mysql and tried a lot of things.
Ok, I solved in this way:
I used Software & Updates application to remove mariadb sources
executed the followings steps (ref https://askubuntu.com/a/934576):
sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install
sudo apt install mysql-server
This fixed it for me (MySQL 8.0 - Ubuntu 20.04)
sudo apt-get purge mysql\* libmysql\*
sudo apt autoremove
But the package "mysql-client-core-8.0" don't uninstall, so...
sudo apt --fix-broken install
sudo apt-get --reinstall install mysql-client-core-8.0
sudo apt-get purge mysql\* libmysql\*
sudo apt autoremove
sudo apt update
sudo apt install mysql-server
No more errors!
Try this:
sudo dpkg -P mysql-server mysql-server-5.1
sudo apt-get autoremove
sudo apt-get clean
dpkg -l | grep -i mysql
sudo rm -rvf /var/lib/mysql
sudo apt-get install mysql-server
The step dpkg -l | grep -i mysql will show you all mysql modules, which are installed. It should be empty before the next steps.
This error could also happen if the port (3306) is being used by another app. In my case, I had a docker container running mysql which was using the 3306 port. Hence my local mysql installation failed to configure.
$ sudo netstat -nltp | grep LISTEN | grep 3306
$ sudo netstat -nltp | grep LISTEN | grep 3306
tcp6 0 0 :::3306 :::* LISTEN 1017033/docker-prox
sudo apt purge --auto-remove mysql*
sudo rm -r /etc/mysql
sudo rm -r /var/lib/mysql*
sudo apt install mysql-client-8.0 mysql-server-8.0 --fix-broken -y

mysql - installing or upgrading mysql 5.5 to 5.6 in Linux mint

Following error message getting while upgrading from Mysql 5.5 to 5.6.
The following packages have unmet dependencies:
mysql-client-5.6 : Depends: mysql-client-core-5.6 but it is not going to be installed
mysql-server-5.6 : Depends: mysql-server-core-5.6 (=
5.6.19-0ubuntu0.14.04.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I had the same problem which was solved after update and upgrade.
Try this, I hope this works for you:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install mysql-server-5.6
Installing MySQL 5.6 on Linux(debian based distro):
Uninstall any existing version of MySQL:
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-*
mysql-client-core-*
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean
Automatically uninstall mysql:
sudo apt-get autoremove mysql* --purge
sudo apt-get remove apparmor
Download version 5.5.51 from MySQL site
wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz
Add mysql user group:
sudo groupadd mysql
Add mysql (not the current user) to mysql user group:
sudo useradd -g mysql mysql
Extract mysql-5.6.*-linux2.6-x86_64.tar.gz to /usr/local:
cd /usr/local
sudo tar -xvf mysql-5.6.*-linux2.6-x86_64.tar.gz
Create mysql folder in /usr/local:
sudo mv mysql-5.6.*-linux2.6-x86_64 mysql
Set mysql directory owner and user group:
cd mysql
**sudo chown -R mysql:mysql * **
Install the required lib package:
sudo apt-get install libaio1
Execute mysql installation script:
sudo scripts/mysql_install_db --user=mysql
Set mysql directory owner from outside the mysql directory:
sudo chown -R root .
Set data directory owner from inside mysql directory:
sudo chown -R mysql data
Copy the mysql configuration file :
sudo cp support-files/my-medium.cnf /etc/my.cnf
Start mysql:
sudo bin/mysqld_safe --user=mysql &
sudo cp support-files/mysql.server /etc/init.d/mysql.server
Initialize root user password:
sudo bin/mysqladmin -u root password 'test'
Start mysql server:
sudo /etc/init.d/mysql.server start
Stop mysql server
sudo /etc/init.d/mysql.server stop
Check status of mysql:
sudo /etc/init.d/mysql.server status
Enable myql on startup:
sudo update-rc.d -f mysql.server defaults
Add mysql path to the system:
sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
Now directly use the command below to start mysql
mysql -u root -p

Error while installing MYSQL

I was trying to install mysql in ubuntu. I applied following command for it
sudo apt-get install mysql-server-5.5
But got the following error.
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-5.5_5.5.41-0ubuntu0.14.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Please help me to solve the error.
Doing this solved it for me:
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-5.5 mysql-server-core-5.5
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server
seems like there's an error with one of the packages being installed or that quite never installed properly in the past.
http://ubuntuforums.org/showthread.php?t=1642173
here is a link that helps identify the package and how to correct it.
Try given commands.
sudo apt-get purge mysql-client-core-5.6
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-client-core-5.5
sudo apt-get install mysql-server
Try this link
I had this problem And with this method, the problem was solved
1-Get the list of MySQL packages installed on the system by executing the command
sudo dpkg -l | grep mysql
2-Remove the the packages shown above by executing the command
sudo apt-get --purge autoremove <packages from the step 1>
3-Delete /var/lib/mysql
4-To add MariaDB repository to Ubuntu, run the commands below to install the repository key to your system.
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
5-
sudo sh -c "echo 'deb [arch=amd64,i386] https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu '$(lsb_release -cs)' main' > /etc/apt/sources.list.d/MariaDB-10.2.list"
6-After that, run the commands below to install the latest version of MariaDB.
sudo apt-get update
sudo apt-get install mariadb-server mariadb-client
7-
cd /var/run
sudo cp mysqld/ mysqld.bc -rf
sudo chown mysql:mysql mysqld.bc/
sudo service mysql stop
sudo cp mysqld.bc/ mysqld -rf
sudo chown mysql:mysql mysqld -R
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
8-Now able to log in database using
mysql -u root
9-Then to update root password:
UPDATE user SET authentication_string=password('YOURPASSWORDHERE') WHERE user='root';
FLUSH PRIVILEGES;