When running the standard apt-get install mysql-server
on Ubuntu 14.04, the system defaults to installing MySQL 5.5, which lacks many features found in newer versions. Here's why the standard approach fails:
$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
The following NEW packages will be installed:
mysql-server
0 upgraded, 1 newly installed, 0 to remove
Need to get 0 B/9,828 kB of archives
After this operation, 96.7 MB of additional disk space will be used
Selecting previously unselected package mysql-server-5.5
To specifically get MySQL 5.7.9 on Ubuntu 14.04, follow these steps:
# Add the official MySQL APT repository
wget https://dev.mysql.com/get/mysql-apt-config_0.8.0-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.0-1_all.deb
# During installation, select:
# 1. mysql-5.7
# 2. OK
sudo apt-get update
sudo apt-get install mysql-server=5.7.9-1ubuntu14.04
After installation, confirm you have the correct version:
mysql --version
mysql Ver 14.14 Distrib 5.7.9, for Linux (x86_64) using EditLine wrapper
If you encounter dependency issues, try this fix:
sudo apt-get install -f
sudo apt-get --fix-broken install
sudo dpkg --configure -a
For conflicts with existing MySQL installations:
sudo service mysql stop
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
After successful installation, consider these security measures:
sudo mysql_secure_installation
For production environments, adjust the my.cnf configuration:
[mysqld]
performance_schema = ON
innodb_file_per_table = 1
innodb_buffer_pool_size = 1G
When running sudo apt-get install mysql-server
on Ubuntu 14.04, the system typically installs MySQL 5.5 by default from the official Ubuntu repositories. Many developers specifically need MySQL 5.7.9 features like improved JSON support, invisible columns, or generated columns for their applications.
Before proceeding, ensure you have:
- Ubuntu 14.04 system with sudo privileges
- Existing MySQL installations removed (
sudo apt-get remove --purge mysql*
) - Backup of any existing databases
Here's the complete working method for MySQL 5.7.9 installation:
# Add the trusted PPA repository
sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository -y ppa:ondrej/mysql-5.7
sudo apt-get update
# Install specific 5.7.9 version (not just "mysql-server")
sudo apt-get install mysql-server-5.7
# Verify installation
mysql --version
After installation completes, run the security script:
sudo mysql_secure_installation
To check the exact version and confirm successful installation of 5.7.9:
mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.7.9 |
+-----------+
Issue: Package conflicts during installation
Solution: Completely remove previous MySQL installations first:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
Issue: Authentication plugin changes in MySQL 5.7
Solution: Create users with native authentication:
CREATE USER 'newuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Add these to your /etc/mysql/my.cnf
under [mysqld]
section:
innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT