Install MySQL in CentOS6 and configure _ MySQL

Source: Internet
Author: User
CentOS6 install MySQL and configure CentOS6CentOS

CentOS6 modify MySQL configuration

Check whether MySQL is installed. --> run the following command:

rpm -qa | grep mysql 

Uninstall installed MySQL--> Run the following command:

# Rpm-e -- nodeps mysql-libs-5.1.61-4.el6.x86_64 to delete all files in the/var/lib/mysql folder

Install MySQ:

1. run the following command to install mysql-server:

yum -y install mysql-server
2. run the initialization command after the installation is complete.
Service mysqld start or/etc/init. d/mysqld start
3. modify the mysql configuration file (modify the default encoding)

Copy the my-large.cnf file to/etc/my. cnf --> execute the command:

Cp/usr/share/doc/mysql-server-4.1.12/my-large.cnf/etc/my. cnf if prompted whether to overwrite, Y can;

Open my. cnf and modify the encoding --> run the following command:

Vim/etc/my. add: default-character-set = utf8 under [mysqld] to modify the specified default engine: default-storage-engine = INNODB case sensitive: lower_case_table_names = 1 0: case Sensitive 1: case insensitive

Add: default-character-set = utf8 under [client]

4. restart the MySQL service --> run the following command:
Service mysqld restart or/etc/init. d/mysqld restart
5. log on to mysql and run the following command:
Mysql or mysql-uroot-p check mysql encoding show variables like 'character % '; display: + bytes + | Variable_name | Value | + bytes + | character_set_client | utf8 | character_set_connection | utf8 | character_set_database | utf8 | bytes | binary | utf8 | | character_set_server | utf8 | character_set_system | utf8 | character_sets_dir |/usr/share/mysql/charsets/| + ---------------------- + success + modification succeeded;

Assign permissions to the host that connects to MySQL (facilitating remote connection to MySQL database ):

Mysql> grant all on *. * TO 'username' @ '%' identified by 'password' with grant option; // % can be your IP address Note: modify Port 3306 enabled on the firewall; in my blog: http://my.oschina.net/haopeng/blog/268523

After the installation is complete, set the root password for MySQL --> use the command:

/usr/bin/mysqladmin -u root password '123456'

Modify the mysql root password:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');

Mysql installation directory

/Var/lib/mysql database file/usr/share/mysql command and configuration file/usr/bin (commands such as mysqladmin and mysqldump)

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.