installing MySQL
Installing MySQL and Php-mysql
[Root@sample ~]# yum-y Install Mysql-server
Configure MySQL
[Root@sample ~] #vim/etc/my.cnf edit MySQL configuration file
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/ Mysql.sock
# Default to-using old password format for compatibility with MySQL 3.x
# clients (those using the MYSQ LCLIENT10 compatibility package).
Found it
This line, add a new rule below this line, let MySQL's default encoding be UTF-8, add
Default-character-set = UTF8
This line
Then add the following statement to the end of the text in the configuration file:
[MySQL]
Default-character-set = UTF8
[Root@sample ~]# chkconfig mysqld on
Set the MySQL service to boot from the system
[Root@sample ~]# chkconfig--list mysqld
Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[Root@sample ~]#/etc/rc.d/init.d/mysqld start
Initializing MySQL database: [OK]
starting mysql: [OK]
Open MySQL Service remote access
To modify the database configuration:
Authorize the root user to connect remotely, noting that replacing "password" with the root user's real password:
Grant all privileges on *.* to root@ '% ' 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 the following:
Vim/etc/mysql/my.cnf
Found it:
Bind-address = 127.0.0.1
To
bind-address = 0.0.0.0
#允许任意ip地址访问
You can also specify an IP address. Then restart MySQL:
Sudo/etc/init.d/mysqld restart