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