Using MySQL under Ubuntu

Source: Internet
Author: User

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

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.