Can't install mysql 5.6 on elementaryos - mysql

I need LAMP on my elementaryos. I already have php, apache, and phpmyadmin.
Mysql has proven to be a problem to me. I've successfully installed mysql 5.7. Unfortunately, the people at mysql decided to add silly changes such as not being able to mysql -uroot -proot without sudo. Because of this change, I can't login via phpadmin with root.
So I've decided to just install mysql 5.6.
I've been following this guide.
Sadly, when I do apt-cache policy mysql-server, this is what I get:
mysql-server:
Installed: (none)
Candidate: 5.7.23-0ubuntu0.18.04.1
Version table:
5.7.23-0ubuntu0.18.04.1 500
500 http://ph.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://ph.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main i386 Packages
5.7.21-1ubuntu1 500
500 http://ph.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
500 http://ph.archive.ubuntu.com/ubuntu bionic/main i386 Packages
The version is 5.7. So now the guide says check /etc/apt/sources.list.d/mysql.list. But this is what I have in there:
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out entries below, but any other modifications may be lost.
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
deb http://repo.mysql.com/apt//ubuntu/ wily mysql-apt-config
deb http://repo.mysql.com/apt//ubuntu/ wily mysql-5.6
deb http://repo.mysql.com/apt//ubuntu/ wily mysql-tools
deb-src http://repo.mysql.com/apt//ubuntu/ wily mysql-5.6
So it's actually correct. But it's still not 5.6.
Can anybody help me out?

1.In Software & Updates/Other Software added 14.04 repository:
deb http://archive.ubuntu.com/ubuntu trusty main
2.Installed mysql client and server:
sudo apt install mysql-server-5.6
sudo apt install mysql-client-5.6
Update: Before installing 5.6, make sure that no other mysql packages are present:
dpkg -l | grep mysql - returns list of mysql packages.
Use apt-get purge <package name> to purge them.
Source: 16.04 upgrade broke mysql-server

Related

How can I install MySQL 5.7 on Ubuntu 22.04 LTS?

The company I am working uses an older stack, and I need to install MySQL 5.7 on my Ubuntu 22.04 LTS to work on some projects locally. Does anyone knows how to do this? I just can't find anything besides installing it on Ubuntu 20.04 or lower.
download:
wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb
dpkg -i mysql-apt-config_0.8.12-1_all.deb
select this options:
Bionic -> MySQL Server and Cluster -> mysql-5.7 -> ok
add key:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
apt-get update
check available mysql versions:
apt-cache policy mysql-server
mysql-server:
Installed: (none)
Candidate: 8.0.27-0ubuntu0.20.04.1
Version table:
8.0.27-0ubuntu0.20.04.1 500
500 http://ru.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
500 http://ru.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages
8.0.19-0ubuntu5 500
500 http://ru.archive.ubuntu.com/ubuntu focal/main amd64 Packages
5.7.37-1ubuntu18.04 500
500 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 Packages
and install it:
apt install -f mysql-client=5.7* mysql-community-server=5.7* mysql-server=5.7*
Done
I have fixed this issue for me with a small trick.What we actually need to do is edit our /etc/apt/sources.list with the source.list available in Ubuntu 20.4. eg. you will get an entry in ubuntu 22 "deb http://in.archive.ubuntu.com/ubuntu/ jammy main restricted"
so just replace jammy by bionic in all places in /etc/apt/sources.list then save and try apt update after then just simply try to install myslq sudo apt install -fmysql-server=5.7* can use this command and now you can able to install mysql successfully.
Once you are installed and mysql is up and running just make sure to revert the /etc/apt/sources.list file.
Reason for doing this is in Ubuntu 22.04 it is not bale to install all required dependencies for mysql5.7 so by editing source.list we allow to install all req dependencies.
Note: Don't use upgrade in while doing this all and make sure you revert the source.list file after myslq installed and plz mark mysql on hold for upgrade because whenever you run an upgrade command it will upgrade the mysql version to 8 from 5.
Hope this work for you. Thanks

Downgrade Mysql 5.5.9 to 5.1 on Ubuntu 14.04

After upgrading to Ubuntu 14.04 Mysql 5.5.9 is incompatible with some of my scripts. I need to re-install Mysql 5.1. I tried research online but no luck
When I do
apt-get install mysql-server-5.1 mysql-client-5.1
Package mysql-server-5.1 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
mysql-server-core-5.5:i386 mysql-server-5.5:i386 mysql-server-core-5.5
mysql-server-5.5
E: Package 'mysql-server-5.1' has no installation candidate
E: Package 'mysql-client-5.1' has no installation candidate
Tried to find multiverse source but no luck,
Anyone?
Uninstall existing mysql
sudo apt-get remove mysql-server
Download the MySQL APT repository config tool (as root)
wget http://dev.mysql.com/get/mysql-apt-config_0.3.5-1debian8_all.deb
Install the MySQL APT repository config tool
dpkg -i mysql-apt-config_0.3.5-1debian8_all.deb
Update APT
apt-get update
Install the server
apt-get install mysql-community-server
Thereby you can select the server you need and install

Upgrade to MariaDB 10 from MariaDB 5.5 via yum fails

I want to upgrade mariadb from 5.5... to 10. But when I run "yum update -y", screen show like below:
Upgrading directly from MySQL <unrecognized version package MariaDB-server-5.5.36-1.el6.x86_64
MariaDB-server-5.5.36-1.el6.x86_64 is not installed> to MariaDB 10.0 may not
be safe in all cases. A manual dump and restore using mysqldump is
recommended. It is important to review the MariaDB manual's Upgrading
section for version-specific incompatibilities.
A manual upgrade is required.
- Ensure that you have a complete, working backup of your data and my.cnf
files
- Shut down the MySQL server cleanly
- Remove the existing MySQL packages. Usually this command will
list the packages you should remove:
rpm -qa | grep -i '^mysql-'
You may choose to use 'rpm --nodeps -ev <package-name>' to remove
the package which contains the mysqlclient shared library. The
library will be reinstalled by the MariaDB-shared package.
- Install the new MariaDB packages supplied by Monty Program AB
- Ensure that the MariaDB server is started
- Run the 'mysql_upgrade' program
How can I fix this issue?
I fix by myself, I post here for anyone need:
I run,
rpm -qa | grep -i '^maria'
Screen show:
MariaDB-common-10.0.12-1
MariaDB-client-10.0.12-1
MariaDB-server-5.5.38-1
MariaDB-shared-10.0.12-1
My "MariaDB-server" is still 5.5, I stop and remove it (backup all before do change anything):
yum remove MariaDB-server
then install again:
yum install MariaDB-server
screen:
Total size: 56 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : MariaDB-server 1/1
Installed:
MariaDB-server.i386 0:10.0.12-1
run again:
rpm -qa | grep -i '^maria'
screen show:
MariaDB-common-10.0.12-1
MariaDB-client-10.0.12-1
MariaDB-server-10.0.12-1
MariaDB-shared-10.0.12-1
It's OK.
I recently found steps on the official MariaDB website for upgrading to the latest stable version.
under /etc/yum.repos.d/ add MariaDB.repo with the following configs:
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Run sudo yum install MariaDB-server MariaDB-client
Full steps can be found in this tutorial

MySQL: Package 'mysql-server' has no installation candidate

This error is being shown whenever I want to install any software via command line.
Even if i try to install softwares which I know are present at the source from where I am downloading.
Below is the full error message i am getting :
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'mysql-server' has no installation candidate
It worked for me.
If you have followed all the previous steps successfully and after running sudo apt-get install mysql-server you are getting an error then try this
sudo apt-get install mariadb-server
I experienced this issue when trying to install MySQL Server on Debian 10.
Here's how I fixed it:
The issue is caused by the MySQL server apt repository not being included in your system's software repository list. In Debian 10 for example, MariaDB, a community fork of the MySQL project, is packaged as the default MySQL variant.
So to fix this first, add the MySQL server apt repository to your system's software repository list. Follow these steps:
Go to the download page for the MySQL APT repository at:
https://dev.mysql.com/downloads/repo/apt/
Select and download the release package for your Linux distribution. You can use:
sudo wget https://the-download-link
In my case it was:
sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
Install the downloaded release package with the following command, replacing version-specific-package-name with the name of the downloaded package (preceded by its path, if you are not running the command inside the folder where the package is):
sudo dpkg -i version-specific-package-name.deb
In my case it was:
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
Note: dpkg is used to install, remove, and inspect .deb software packages. The -i flag indicates that we’d like to install from the specified file.
During the installation, you’ll be presented with a configuration screen where you can specify which version of MySQL you’d prefer, along with an option to install repositories for other MySQL-related tools. The defaults will add the repository information for the latest stable version of MySQL and nothing else. This is what we want, so use the down arrow to navigate to the Ok menu option and hit ENTER.
You'll also be asked to select a repository to add. Choose 'debian buster' which has the package 'mysql-server' in it. After the adding this repository you can update the repository and use the below command to install MySQL.
sudo apt-get install mysql-server
The package will now finish adding the repository. Refresh your apt package cache to make the new software packages available:
sudo apt update
Note: If you ever need to update the configuration of these repositories, just run sudo dpkg-reconfigure mysql-apt-config, select new options, and then sudo apt-get update to refresh your package cache.
Install MySQL by the following command:
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
Note: This installs the package for the MySQL server, as well as the packages for the client and for the database common files. During the installation, you are asked to supply a password for the root user for your MySQL installation.
The MySQL server is started automatically after installation. You can check the status of the MySQLserver with the following command:
sudo service mysql status
Stop the MySQL server with the following command:
sudo service mysql stop
To restart the MySQL server, use the following command:
sudo service mysql start
MySQL creates a default user called root. You can change the password to any password of your choice by logging in to MySQL console using socket authentication:
sudo mysql -u root
Then run the command below to change the password
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'your-preferred-password';
Reference:
A Quick Guide to Using the MySQL APT Repository
How To Install the Latest MySQL on Debian 10
That's all.
I hope this helps
You can install mysql by
sudo apt install default-mysql-server
--------
sudo service mysql status
● mariadb.service - MariaDB 10.3.31 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-02-09 13:19:33 +08; 33s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 18537 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 31 (limit: 4915)
Memory: 73.1M
CGroup: /system.slice/mariadb.service
└─18537 /usr/sbin/mysqld
run:
apt install default-mysql-server
which installs MariaDB unfortunately, but still responds to service mysql status
Most likely you are running on ubuntu. It is important to run apt-get update first.

Update MySQL version from 5.1 to 5.5 in CentOS 6.2

I tried to update MySQL from 5.1 to 5.5 in CentOS 6.2. The following is the process I did:
1. rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
2. yum install libmysqlclient15 --enablerepo=webtatic
3. yum remove mysql mysql-*
4. yum install mysql55 mysql55-server --enablerepo=webtatic
When I tried the 4th step, I got the following output:
[root#d2005 /]# yum install mysql55 mysql55-server --enablerepo=webtatic
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
* base: yum.singlehop.com
* extras: centos.mirrors.tds.net
* updates: pubmirrors.reflected.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql55.x86_64 0:5.5.10-1.w5 will be installed
--> Processing Dependency: mysql55-libs = 5.5.10-1.w5 for package: mysql55-5.5.10-1.w5.x86_64
---> Package mysql55-server.x86_64 0:5.5.10-1.w5 will be installed
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.10-1.w5.x86_64
--> Running transaction check
---> Package mysql55-libs.x86_64 0:5.5.10-1.w5 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.61-1.el6_2.1 will be installed
--> Processing Conflict: mysql55-libs-5.5.10-1.w5.x86_64 conflicts mysql-libs < 5.5.10
--> Finished Dependency Resolution
Error: mysql55-libs conflicts with mysql-libs
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
How to fix it?
To list Old MySql
yum list installed | grep -i mysql
To remove Old MySql
yum remove mysql mysql-*
Remi Dependency on CentOS 6 and Red Hat (RHEL) 6
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install MySQL server
yum --enablerepo=remi,remi-test install mysql mysql-server
To list New MySql
yum list installed | grep -i mysql
start MySql server
/etc/init.d/mysqld start ## use restart after update
OR
service mysqld start ## use restart after update
chkconfig --levels 235 mysqld on
Last
mysql_upgrade -u root -p
Now my MySql version is 5.5.32
Ref:
http://www.webtatic.com/packages/mysql55/
http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/
Hope it help some one
NOTE:
Adding comments from #pim (in comments)
Just wanted to add that after the upgrade, my crontab was removed as well. Had to reinstall with "yum install vixie-cron" (CentOS 6)
I used the following commands to add a new YUM repo and make the update:
Download the Remi repo
cd /etc/yum.repos.d
wget http://rpms.famillecollet.com/enterprise/remi.repo
Install/Update the mysql version
yum --enablerepo=remi install mysql-server
OR
yum --enablerepo=remi update mysql-server
You appear to have been using the wrong Webtatic Yum repository version than the one for your version of CentOS. See http://www.webtatic.com/projects/yum-repository/ for details
e.g.
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
You can use a yum plugin made by the IUS community to switch mysql-libs with mysql55w-libs. (the following assuming you still use Webtatic)
yum install mysql yum-plugin-replace
yum replace mysql --replace-with mysql55w
That should allow you to replace mysql with mysql55w-libs, whilst maintaining the older libmysqlclient for any dependencies.
If you see other packages than mysql being removed, then be careful, as they might be needed, but using this method, I've found to be reliable whenever I've used it.
I'm posting this solution as Remi's repository is not always the ideal solution. This method is more complex, but would never cause you to accidentally update your entire web stack by using repositories that use package names matching base distribution packages.
2015/08/19 - For those of you working on older (but still decent) hardware with a matching OS (typically 32 bit machines).
-- This will upgrade to mysql 5.6 community not 5.5 --
This worked for me after some research and mixing/matching/testing the answers found on various page of the internet (mainly from this page and http://dev.mysql.com/doc/refman/5.6/en/linux-installation-yum-repo.html).
My OS shipped with mysql 5.1, I wanted to have 5.6.
My system
[root#host]# cat /etc/*release
CentOS release 6.7 (Final)
[root#host]# uname -a
Linux host 2.6.32-573.3.1.el6.i686 #1 SMP Thu Aug 13 19:58:36 UTC 2015 i686 i686 i386 GNU/Linux
[root#host]# arch
i686
This is installed on a 2006 mac pro 1.1 (CPUs upgraded to 3.0GHz Intel Xeon X5365 Quad-Core).
Commands I ran
This was done almost immediately after a fresh install of the OS and system update via yum
list mysql currently installed
yum list installed | grep -i mysql
remove installed msql
yum remove mysql mysql-*
list mysql currently installed
yum list installed | grep -i mysql
Download rpm containing mysql 5.6
wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Install mysql
rpm -Uvh mysql-community-release-el6-5.noarch.rpm
yum install mysql mysql-server
list mysql currently installed
yum list installed | grep -i mysql
ensure mysql starts on reboot
chkconfig --list mysqld
sudo chkconfig mysqld on
chkconfig --list mysqld
Start mysql
service mysqld start
service mysqld status
Result
[root#host]# yum list installed | grep -i mysql
compat-mysql51.i686 5.1.54-1.el6.remi #remi
mysql-community-client.i686
5.6.26-2.el6 #mysql56-community
mysql-community-common.i686
5.6.26-2.el6 #mysql56-community
mysql-community-libs.i686
5.6.26-2.el6 #mysql56-community
mysql-community-release.noarch
mysql-community-server.i686
5.6.26-2.el6 #mysql56-community
perl-DBD-MySQL.i686 4.013-3.el6 #base
[root#host]# mysql --version
mysql Ver 14.14 Distrib 5.6.26, for Linux (i686) using EditLine wrapper
mysql config (I did not touch this yet but the info seems legit)
Some interesting basic but efficient performance tuning for mysql:
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-5-6-from-official-yum-repositories
Good luck!
Edit
I had some issues creating users and granting permissions, this how it was fixed.
Error
ERROR 1054 (42S22) at line 1: Unknown column 'plugin' in 'mysql.user'
Fix
Logged on the server as root
Connected to mysql with a simple mysql
Checked the outcome of this statement: SELECT COUNT(1) column_count FROM information_schema.columns WHERE table_schema='mysql' AND table_name='user'; The result was 39, 43 is expected for mysql 5.6
Issued this statement to update the root password: update mysql.user set Password=PASSWORD('root') where User='root';
(Logged off mysql with exit)
Restarted mysql with: service mysqld restart
Ran: mysql_upgrade -uroot -proot --force
Reconnected to mysql with mysql -uroot -proot
Checked the outcome of this statement: SELECT COUNT(1) column_count FROM information_schema.columns WHERE table_schema='mysql' AND table_name='user'; The result was 43 as expected for mysql 5.6. I was then able to create my users and grant permissions as needed.
Above replies didn't work for me (got this error - error: /var/tmp/rpm-tmp.tyukGy: not an rpm package).
I followed these steps -
## Remove existing/old MySQL ##
yum remove mysql mysql-*
rm -rf /var/lib/mysql
rm -rf /var/log/mysql*
## Install Remi Repository on RHEL/CentOS 6.7-6.0 ##
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
## Install Remi Repository on RHEL/CentOS 5.4-5.0 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
yum --enablerepo=remi list mysql mysql-server
yum --enablerepo=remi install mysql mysql-server
Taken from - http://www.tecmint.com/install-mysql-on-rhel-centos-6-5-fedora-17-12/
By doing above, i uninstalled MySQL 5.0.* and replaced it with this -
[root#localhost]# /usr/bin/mysqladmin -u root -p version
/usr/bin/mysqladmin Ver 8.42 Distrib 5.5.28, for Linux on x86_64
Copyright (c) 2000, 2012, 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.
Server version 5.5.28
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 32 sec
Threads: 1 Questions: 3 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.093
[root#localhost]#
My CentOS version -
[root#localhost]# cat /etc/redhat-release
CentOS release 6.3 (Final)
[root#localhost]# uname -a
Linux localhost.localdomain 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Use CentOS-Release-SCL is better and easy.
The Software Collections ( SCL ) Repository
# yum install centos-release-SCL
# yum install mysql55-mysql-server
Done.
This blog post helped me upgrade from MySQL 5.5.15 to 5.5.28. That upgrade also had the problem with mysql-libs clashing with mysql55-libs.
wget -P /etc/yum.repos.d http://rpms.famillecollet.com/enterprise/remi.repo
yum --enablerepo=remi -y install mysql-server
OR
yum --enablerepo=remi -y update mysql-server