Getting strange errors while downloading mysql
My observation was that error "Cannot stat file /proc/2801/fd/1023: Permission denied" which I never faced before, probably need @Ryan Akuszewski laptop for further analysis. I am suprised with the error "installed mysql-server-5.7 package post-installation script subprocess returned error exit" because @Ryan Akuszewski was installing
MYSQL 8.0.13 server
however there was a reference to"mysql-server-5.7 package"
which was odd. The problem should be with dependencies, so the laptop requires to sort them out before proceeding to install. That is why I began the process with dependency installation.If any one has better insight into this issue, please come out and share their expert opinion.
You may need to install the libaio
library if it is not already present on your system:
how to check if libaio is installed (quickly)
$ apt-cache policy libaio1
If it's installed, it will display the version installed, if it's not, it will display the lines of text. If it is installed then skip Install libaio and goto step-1.
Install libaio
$ sudo apt-get install libaio1 libaio-dev
Note: use the following commands in order to fix all the dependencies for libaio1
, libmecab2
and so on.
$ sudo aptitude update
$ sudo aptitude upgrade
Note: Make sure that aptitude
has been installed in Ubuntu.
Figure-1: Install libaio1
Step 1 Get MySQL APT Repository
The MySQL package version that comes with Ubuntu default repositories is not the latest version. If you need to install the latest version of MySQL database, you may want to install its repository in Ubuntu. You can also use the command line to download, changing the version number of the package.
$ cd /tmp/ && wget
https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
Then run the commands below to install
$ sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
When you run the commands above, you should get a config prompt. Just select OK as shown in the image below.
MySQL APT Repo features MySQL Server along with a variety of MySQL components. You may select the appropriate product to choose the version that you wish to receive.
Step 2: Install MySQL 8.0.13 Server and Client.
Now that the repository is installed, run the commands below to install
$ sudo apt update
$ sudo apt install mysql-server mysql-client
There are also packages with server-core
and client-core
in the package names. These
contain binaries only and are installed automatically by the standard packages. Installing them by themselves will not result in a functioning MySQL setup.
If you are being warned of unmet dependencies by dpkg
, you can fix them using apt-get
:
$ sudo apt-get -f install # Fix/correct the system with any broken dependencies in place.
$ cd ~
Here are where the files are installed on the system:
- All configuration files (like
my.cnf
) are under/etc/mysql
- All binaries, libraries, headers, etc., are under
/usr/bin
and/usr/sbin
- The data directory is under
/var/lib/mysql
Warning: Debian distributions of MySQL are also provided by other vendors. Be aware that they may differ from those built by Oracle in features, capabilities, and conventions (including communication setup), and that the instructions in this manual do not necessarily apply to installing them. The vendor's instructions should be consulted instead.
When you run the commands above, you should get a config prompt. Just select OK as shown in the image below. But unfortunately, my observation was, MySQL was not supporting Cosmic Cuttlefish
(Ubuntu 18.10), the installation was trying to abort, but you can select Ubuntu Bionic
(18.04) and go ahead with installation. Use Up arrow and select ubuntu bionic
(18.04) as shown in figure-1.
Navigational Tips:
a) Use ↑or↓ to position the cursor on your choice of System.
b) Hit Spacebar to mark your selection (Don't ignore this step).
c) Use Tab to navigate to OK
button and press Return.
Figure-2: Select ubuntu bionic (18.04) in the absence of ubuntu cosmic (18.10)
MySQL APT Repo features MySQL Server along with a variety of MySQL components. You may select the appropriate product to choose the version that you wish to receive.
Figure-3: Select appropriate product
During the installation, you should be prompted to create and confirm a MySQL root password.
Figure-4: Enter password
Figure-5: Re-Enter password
Also, you confirm whether you want to use the new password encryption feature. it’s recommended.
Figure-6: password encryption feature
Figure-7: Configuring mysql communuty server
Special Notes on Upgrading the Shared Client Libraries
- You can install the shared client libraries from MySQL APT repository
by the following command (see Installing Additional MySQL Products
and Components with APT for more details):
shell> sudo apt-get install libmysqlclient20
- If you already have the shared client libraries installed from you Linux platform's software repository, it can be updated by the MySQL APT repository with its own package by using the same command (see Replacing the Native Distribution by an APT Update for more details).
- After updating MySQL using the APT repository, applications compiled with older versions of the shared client libraries should continue to work.
To install the shared client libraries:
$ sudo apt-get install libmysqlclient18
Figure-8: install the shared client libraries
The MySQL services should start automatically after installation, check its status to ensure that it is up and running.
$ sudo service mysql status
After that, MySQL should be installed, you can logon by running the commands:
$ sudo mysql -u root -p
You should see MySQL welcome screen shown below:
Figure-9: Login into mysql
Step 3: Verify the MySQL Installation
$ dpkg --get-selections | grep mysql # Show packages relating to mysql
Figure-10: Show packages relating to mysql
Thus the list of packages is shown in the above figure-10.
$ dpkg --status mysql-server # Check the details of a package
Figure-11: Status of mysql server
The status of server is shown in the above figure-11.
$ dpkg --listfiles mysql-server # List the installed files of a package
Figure-12: List the installed files of the package
The following commands will check the location of "mysqld"
(MySQL server deamon):
$ which mysqld
Figure-13: Location of mysql server deamon
$ whereis mysqld
Figure-14: Where is msqld?
As seen from the above output, the MySQL server daemon mysqld
is installed at /usr/sbin
(System-Software Binaries).
$ man mysqld // Read the manual
Figure-15: Read the manual for MySQL server daemon
The following commands will check the location of "mysql" (MySQL command-line client)
$ which mysql
Figure-16: Mysql is installed in '/usr/bin'
$ whereis mysql
Figure-17: Mysql related directories
As seen from the above output, the MySQL command-line client mysql
and utilities such as mysqladmin
and mysqldump
are located at /usr/bin
(Application Software Binaries).
$ man mysql // Read the manual
Figure-18: Read the manual for MySQL Command line tool
Step 4: Configure MySQL Server
MySQL reads the startup options from the files shown below, in the specified order (top files are read first, files read later take precedence. Reference: http://dev.mysql.com/doc/refman/5.7/en/option-files.html)
/etc/my.cnf
/etc/mysql/my.cnf
SYSCONFDIR/my.cnf
$MYSQL_HOME/my.cnf (server only)
- The file specified in
--defaults-extra-file
startup option, if any ~/.my.cnf
-
~/.mylogin.cnf
(client only)
The installation default /etc/mysql/my.cnf
includes directories /etc/mysql/conf.d/
and /etc/mysql/mysql.conf.d/.
The /etc/mysql/conf.d/mysql.cnf
is empty. Hence, the main configuration file is /etc/mysql/mysql.conf.d/mysqld.cnf
.
Browse through /etc/mysql/mysql.conf.d/mysqld.cnf
:
[mysqld]
user = mysql
port = 3306
basedir = /usr
datadir = /var/lib/mysql
......
log_error = /var/log/mysql/error.log
......
- A special user called
"mysql"
is created to run the MySQL server. - The server runs on the default port number of
3306
. - The data directory is located at
/var/lib/mysql
(owned bymysql:mysql
). - The error log is located at
/var/log/mysql/error.log
.
Step 5: Start/Shutdown MySQL Server (mysqld
)
MySQL is run as a service called "mysql"
(configured at "/etc/init.d/mysql"
), which is started automatically after boot. To start/stop/restart mysql, you could:
$ sudo service mysql start
$ sudo service mysql stop
$ sudo service mysql restart # Stop and start
$ sudo service mysql status # Show the status
MySQL server will be started automatically after the installation. You CANNOT start another instance! To check the mysqld
process:
$ ps aux | grep mysqld
Figure-18: mysqld instance has begun
Step 6: Start/Stop MySQL Command-line Client (mysql
)
To start a MySQL client:
$ mysql -u root -p # Enter the password for the root user you have set in Step 1
mysql> select user, host, authentication_string from mysql.user;
Figure-20: Host and Authentication_string information for various users
mysql> exit
Step 7: Check Status of MySQL.
$ sudo service mysql status # Show the status
Figure-21: Status information of Mysql Server Process.
That how to install the latest version of MySQL on Ubuntu! Enjoy!!