Install MySQL in Linux

  1. Download MySQL Community Server 5.5 for your Linux distribution. Be sure to download a MySQL-server and a MySQL-client package.
  2. Complete the MySQL Community Server installation by following the instructions for your Linux distribution, which are available from MySQL Documentation.
  3. At a command prompt, type the following command:
    mysqladmin -u root password "<your_root_password>"
    where <your_root_password> is the password you want to specify for the database root user.
  4. To stop the MySQL daemon, at the command prompt, type the following command:
    mysqladmin shutdown --user=root --password=<your_root_password>
    where <your_root_password> is the password that you specified for the database root user in the previous step.
  5. Copy the my-medium.cnf file from the MySQL installation folder to a location of your choice.
  6. In the location where you copied the file, rename the my-medium.cnf file to my.cnf.
  7. Configure the MYSQL_HOME environment variable to point to the location of my.cnf, to use my.cnf as your MySQL configuration file.
  8. In a text editor, open the my.cnf file. In the [mysqld] section, do the following:
    1. Add sql_mode="TRADITIONAL" to configure the database to behave like a traditional SQL database management system.
    2. Add character_set_server=utf8 to use UTF-8 as the default character set.
    3. Add collation_server=utf8_bin to use a case-sensitive collation type, or add collation_server= utf8_unicode_ci to use a case-insensitive collation type.
    4. Add skip-character-set-client-handshake to enforce the use of a UTF-8 encoding in the database.
  9. To start the MySQL daemon, at the command prompt, type the following command:
    mysqld_safe &
  10. To start the MySQL console, at the command prompt, type the following command:
    mysql --user=root --password=<your_root_password>
    where <your_root_password> is the password for the database root user that you specified in step 3.
  11. To create a database for the Push Service SDK, in the MySQL console, at the command prompt, type the following command:
    CREATE DATABASE pushsdk;
  12. To create a database user with permissions to perform operations on the database that you created in the previous step, in the MySQL console, at the command prompt, type the following command:
    CREATE USER '<username>' IDENTIFIED BY '<password>';
    where <username> and <password> are the username and password.
  13. To grant permissions to this user to perform operations on the database, in the MySQL console, at the command prompt, type the following command:
    GRANT ALL ON pushsdk.* TO '<username>';
    where <username> is the username for the database user that you created in the previous step.
  14. To create a user with permissions to perform operations on the database that you created in the previous step, in the MySQL console, at the command prompt, type the following command:
    CREATE USER '<username>'@'localhost' IDENTIFIED BY '<password>';
    where <username> and <password> are the username and password.
  15. To grant permissions to this user to perform operations on the database, in the MySQL console, at the command prompt, type the following command:
    GRANT ALL ON pushsdk.* TO '<username>'@'localhost';
    where <username> is the username for the database user that you created in the previous step.

Last modified: 2015-06-11



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus