Install MariaDB and mariadb in CentOS7

Source: Internet
Author: User

Install MariaDB and mariadb in CentOS7
Install MariaDB1.

yum -y install mariadb mariadb-server
2. After MariaDB is installed, start MariaDB first.
systemctl start mariadb
3. Set startup
systemctl enable mariadb
4. Perform simple configuration of MariaDB
Mysql_secure_installation ** 1) First, set the password. You will be prompted to Enter the password ** enter current password for root (Enter for none ): <-when you first run the command, press enter [1] to Set the password Set root password? [Y/n] <-whether to set the root user password. enter y and press enter or press enter New password: <-set the root user password Re-enter new password: <-enter the password you set again [2] other configuration Remove anonymous users? [Y/n] <-do you want to delete anonymous users? Enter y and press ENTER or press Disallow root login remotely? [Y/n] <-do you want to disable remote root login? Enter n and press enter to Remove test database and access to it? [Y/n] <-do you want to delete the test database? Enter y and press ENTER or press enter to Reload privilege tables now? [Y/n] <-whether to reload the permission table. Enter y and press ENTER or press ENTER ** 2) to initialize MariaDB, next, test logon. ** mysql-uroot-p <-press enter and enter the password.
Configure the MariaDB Character Set editing file/etc/my. cnf
[1] vi/etc/my. cnf [2] add init_connect = 'set collation_connection = utf8_unicode_ci 'init_connect = 'set NAMES utf8' character-SET-server = utf8 collation-server = javasskip- character-set-client-handshake
Edit the/etc/my. cnf. d/client. cnf File
[1] vi/etc/my. cnf. d/client. cnf [2] add default-character-set = utf8 under the [client] Tab
Edit file/etc/my. cnf. d/mysql-clients.cnf
[1] vi/etc/my. cnf. d/mysql-clients.cnf [2] add default-character-set = utf8 under the [mysql] Tab
All configurations are complete. Restart mariadb.
systemctl restart mariadb
Go to MariaDB to view the character set
mysql -u root -pshow variables like "%character%";
        +--------------------------+----------------------------+        | Variable_name            | Value                      |        +--------------------------+----------------------------+        | character_set_client     | utf8                       |        | character_set_connection | utf8                       |        | character_set_database   | latin1                     |        | character_set_filesystem | binary                     |        | character_set_results    | utf8                       |        | character_set_server     | latin1                     |        | character_set_system     | utf8                       |        | character_sets_dir       | /usr/share/mysql/charsets/ |        +--------------------------+----------------------------+        8 rows in set (0.01 sec)
show variables like "%collation%";
        +----------------------+-------------------+        | Variable_name        | Value             |        +----------------------+-------------------+        | collation_connection | utf8_general_ci   |        | collation_database   | latin1_swedish_ci |        | collation_server     | latin1_swedish_ci |        +----------------------+-------------------+        3 rows in set (0.00 sec)
Enable remote connection

Disable firewall or open port 3306

Disable Firewall

    systemctl stop firewalld.service    systemctl disable firewalld.service

Allow port 3306 (recommended)

    firewall-cmd --zone=public --add-port=3306/tcp --permanent

Enable remote connection

Enable remote connection from any IP address of the root user

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'root' WITH GRANT OPTION;    flush privileges;

Enable the remote connection of the specified IP address of the root user (recommended)

Grant all privileges on *. * TO 'root' @ 'the IP address 'identified BY 'root' with grant option; flush privileges;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.