MySQL installation and configuration

Feedback


Software environment

Operating System

The MySQL server runs on Linux, Windows, or Mac OS X, and the default port is 3306. By default, the data is stored in [installation path]/data.

Software version

SuperMap GIS Server supports MySQL version 5.6.16 and above.

Installing MySQL on Windows

MySQL provides product packages in both MSI installation and zip package formats. The MSI installation package is easy to install and can be completed according to the installation wizard. This article is based on the zip package of MySQL 5.6.31 to introduce the installation and configuration method of MySQL:

Go to the MySQL official website to download the zip package and unzip it.

Install MySQL

Open a command line window in the bin directory of the MySQL installation path, and enter the MySQL installation command:

mysqld -install

When "service successfully installed" is displayed, the installation is successful.

Start MySQL

Start MySQL with the following command:

net start mysql

Log in to MySQL

After successful startup, enter MySQL for management and configuration. Execute the following command to log in to MySQL:

mysql -u root -p

When using MySQL for the first time, there is no password by default, just press Enter.

Change the login password, for example, set the password to iserver:

set password =password('iserver');

After setting up, you need to enter the password when you log in to MySQL again.

Modify the encoding format

When using MySQL in iServer/iPortal/iEdge, the encoding format needs to be modified to utf-8 to support Chinese. Get into MySQL, execute the following commands in turn:

set character_set_server=utf8;

set character_set_database=utf8;

You can also directly modify the encoding format in the MySQL configuration file. Copy the my-default.ini file from the MySQL installation directory to the same level directory, rename it to my.ini, edit the file, and directly copy the following lines of code to the my.ini file, overwriting the existing [mysqld] line:

[client]

default_character_set=utf8

[mysqld]

character_set_server=utf8

After modification, execute the following command to check whether the encoding format is modified successfully:

show variables like 'character%';

Precautions

sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Installing MySQL on a Linux system

This article takes Ubuntu 15.10.1 as an example to introduce the method of installing MySQL on Linux.

Obtain and install MySQL

On a Linux system, you can directly execute the following command to obtain the MySQL package and install it:

sudo apt-get install mysql-server

The password for the root user can be set during the installation process, here iserver.

After the installation is complete, execute the following command to check that MySQL is running properly:

sudo netstat -tap|grep mysql

If MySQL does not start normally, execute the following command to restart:

sudo /etc/init.d/mysql restart

Modify the encoding format

On Linux systems, you can modify the encoding format in the config file. First, copy the MySQL config file to the /etc/ directory:

cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/my.cnf

To modify the encoding format in the my.cnf:

vi /etc/my.cnf

Add the following settings under [mysqld]:

default-character-set=utf8

Enter at the end of the file "wq!" to save the changes and quits editing.

After modification, enter MySQL to check whether the encoding format is modified successfully:

mysql -u root -p

show variables like 'character%';

Precautions

sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Use MySQL

The command to use MySQL is the same on both Windows and Linux systems, using the root user to enter MySQL:

mysql -u root -p

Create the database

You can create a database specifically for storage information by entering the following command in a command line window:

create database [database name];

For example:

create database iserver ;

Set up database remote connection

Switch to the database for which you want to set up the connection:

use iserver

Open a remote connection so that a designated user on another machine can operate on your database:

grant all privileges on *.* to 'root'@'%' identified by 'iserver' with grant option;

The 'root' is the specified user name, and the 'iserver' is the password for the user to access the database. '%' means that all remote connections are allowed, you can also specify the IP addresses that are allowed here.

After the modification is completed, execute the following command to refresh the configuration and make it effective:

flush privileges;

Once you have configured MySQL according to the above steps, you can use MySQL in iServer/iPortal/iEdge to store security information. Please refer to the security info storage for the specific configuration method. In addition, you can use the MySQL stores portal data and monitoring information in iPortal. For specific configuration methods, please refer to Portal Data Storage Configuration.