Monday, October 9, 2017

Fresh Installation of MySQL on Debian (including Ubuntu)

Note
The following instructions assume that no versions of MySQL (whether distributed by Oracle or other parties) have already been installed on your system; if that is not the case, follow the instructions given in Replacing a Native Distribution of MySQL Using the MySQL APT Repository or Replacing a MySQL Server Installed by a Direct deb Package Download instead.
  1. Adding the MySQL APT Repository

    First, add the MySQL APT repository to your system's software repository list. Follow these steps:
    1. Go to the download page for the MySQL APT repository at http://dev.mysql.com/downloads/repo/apt/.
    2. Select and download the release package for your Linux distribution.
    3. 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):
      shell> sudo dpkg -i /PATH/version-specific-package-name.deb

For example, for version w.x.y-z of the package, the command is:
shell> sudo dpkg -i mysql-apt-config_w.x.y-z_all.deb
  • Note that the same package works on all supported Debian and Ubuntu platforms.
  • During the installation of the package, you will be asked to choose the versions of the MySQL server and other components (for example, the MySQL Workbench) that you want to install. If you are not sure which version to choose, do not change the default options selected for you. You can also choose none if you do not want a particular component to be installed. After making the choices for all components, choose Ok to finish the configuration and installation of the release package.
    You can always change your choices for the versions later; see Selecting a Major Release Version for instructions.
  • Update package information from the MySQL APT repository with the following command (this step is mandatory):
    shell> sudo apt-get update

  • Instead of using the release package, you can also add and configure the MySQL APT repository manually; see Appendix A: Adding and Configuring the MySQL APT Repository Manually for details.
    Note
    Once the MySQL APT repository is enabled on your system, you will no longer be able to install any MySQL packages from your platform's native software repositories until the MySQL APT repository is disabled.
  • Installing MySQL with APT

    Install MySQL by the following command:
    shell> sudo apt-get install mysql-server
  • 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, there are two requests by the dialogue boxes:
    • Supply a password for the root user for your MySQL installation.
      Important
      Make sure you remember the root password you set. Users who want to set a password later can leave the password field blank in the dialogue box and just press Ok; in that case, root access to the server will be authenticated by Socket Peer-Credential Pluggable Authentication for connections using a Unix socket file. You can set the root password later using the program mysql_secure_installation.
    • Indicate if you want to install the test database with Yes or No. Installation of the test database is not recommended for production environments.
  • Starting and Stopping the MySQL Server

    The MySQL server is started automatically after installation. You can check the status of the MySQL server with the following command:
    shell> sudo service mysql status

  • Stop the MySQL server with the following command:
    shell> sudo service mysql stop

    To restart the MySQL server, use the following command:
    shell> sudo service mysql start
    Note
    A few third-party native repository packages that have dependencies on the native MySQL packages may not work with the MySQL APT repository packages and should not be used together with them; these include akonadi-backend-mysql, handlersocket-mysql-5.5, and zoneminder.

    No comments:

    Post a Comment