First step: Install MySQL
Apt-get Install Mysql-server
Step two: set Allow Telnet
Modify the/ETC/MYSQL/MY.CNF (this file is a MySQL configuration file). Comment out the binding-address=127.0.0.1 in the file.
Log in Mysql:mysql-u root-p from this machine
Use MySQL;
Set allow all hosts to connect to MySQL, execute command: Grant all privileges on * * to [email protected] "%" identified by "root user password" with GRANT option;
Step Three:
Restart MySQL
/etc/init.d/mysql restart
* Note:/etc/init.d/mysql Start|stop|restart can start/stop/restart
Fourth step: Set boot from start
Add the Start command (/etc/init.d/mysql start) to the/etc/rc.local file
Fifth step: Set up the MySQL character set:
Specify a character set when creating a database: Create databases mydb character set utf-8;
View current character set: Show variables like ' character% ';
To modify the character set of the current database:
mysql> SET character_set_client = UTF8;
mysql> SET character_set_connection = UTF8;
mysql> SET character_set_database = UTF8;
mysql> SET character_set_results = UTF8;
mysql> SET character_set_server = UTF8;
mysql> SET NAMES UTF8; This statement will change the character set of the three character_set_client character_connection character_results
END
Precautions
/etc/init.d/mysql Start|stop|restart can start/stop/restart
-bash:mysql:command not found
Log in MySQL with mysql command error, the reason is not set environment variables, need to set, or go to the bin directory to login Cd/usr/local/mysql/bin
Mysql-u Root
Using MySQL under Ubuntu