How to install MySQL and open MySQL remote access in the CentOS system

Source: Internet
Author: User

Install MySQL

Installing MySQL and Php-mysql

Configure MySQL

[[Email protected] ~] #vim/etc/my.cnf Edit the MySQL configuration file [mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# Default to using old password format for compatibility with MySQL 3.x# clients (those using the mysqlclient10 compatibilit Y package).

Found it

Old_passwords=1

This line, add a new rule below this line, let MySQL default code is UTF-8, add

Default-character-set = UTF8

This line
Then add the following statement at the end of the configuration file:
[MySQL]

Default-character-set = UTF8
start the MySQL service
[Email protected] ~]# chkconfig mysqld on
set up MySQL service to boot from system startup
[Email protected] ~]# chkconfig--list mysqld
confirm MySQL self-booting
Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Ok if the 2--5 is on
[[email protected] ~]#/etc/rc.d/init.d/mysqld start
start the MySQL service
Initializing MySQL database: [OK]starting mysql: [OK]

Open MySQL Service remote access

To modify the database configuration:

To authorize the root user to connect remotely, pay attention to replacing the "password" with the root user's true password:

Grant all privileges on * * to [email protected] '% ' identified by ' password ' with grant Option;flush privileges;

The second line commands the settings to take effect and can be connected immediately.

The Ps:ubuntu system requires:

Vim/etc/mysql/my.cnf
Found it:
Bind-address = 127.0.0.1
Switch
Bind-address = 0.0.0.0# allows any IP address to be accessed
You can also specify an IP address. Then restart MySQL:
Sudo/etc/init.d/mysqld restart

How to install MySQL and open MySQL remote access in the CentOS system

Related Article

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.