centos6.5 installing MySQL

Source: Internet
Author: User
Tags mysql commands iptables

Check to see if the system has the MySQL-to-use command:
Rpm-qa | grep MySQL
To uninstall an installed mysql--> use command:
#rpm-E--nodeps mysql-libs-*
Delete all files under the/var/lib/mysql folder

MySQL Installation:
Execute command: Install Mysql-server
Yum-y Install Mysql-server
Execute initialization command after installation is complete
Service mysqld start or/etc/init.d/mysqld start
Modify the MySQL configuration file (Modify the default encoding)
Copy the my-large.cnf file to/etc/my.cnf and execute the command:
Cp/usr/share/doc/mysql-server-4.1.12/my-large.cnf/etc/my.cnf
If the hint is overwritten, Y can;
Open MY.CNF Modify the code--Execute command:
Vi/etc/my.cnf
Under [Mysqld], add:
Default-character-set=utf8
To modify the specified default engine:
Default-storage-engine=innodb
Case-sensitive: (0: Case-sensitive 1: case insensitive)
Lower_case_table_names=1

Under [client], add:
Default-character-set=utf8

4. Restart the MySQL service and execute the command:
Service mysqld restart or/etc/init.d/mysqld restart
5. Login to MySQL---execute command:
MySQL or mysql-uroot-p
View MySQL's encoding
Show variables like ' character% ';
Show:
+--------------------------+----------------------------+
| variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | UTF8 |
| character_set_connection | UTF8 |
| Character_set_database | UTF8 |
| Character_set_filesystem | binary |
| Character_set_results | UTF8 |
| Character_set_server | UTF8 |
| Character_set_system | UTF8 |
| Character_sets_dir | /usr/share/mysql/charsets/|
+--------------------------+----------------------------+
Successful modification;
Assign permissions to a host that is connected to MySQL (easy to connect to MySQL database remotely):
Mysql> Grant All on * * to ' username ' @ ' percent ' identified by ' password ' with GRANT OPTION;
Note that here is the SQL statement, not the Linux command Oh, it is not clear that this SQL statement can be Google.
Note: Modify the firewall to open port 3306;
Vi/etc/sysconfig/iptables
-A input-p tcp-m state--state new-m TCP--dport 3306-j ACCEPT
Restart service after saving
/sbin/service iptables Restart
After the installation is complete, set the root password for MySQL and use the command:
/usr/bin/mysqladmin-u root password ' 123456 '
To modify the MySQL root password:
SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' Newpass ');
MySQL installation directory description
/var/lib/mysql Database files
/usr/share/mysql commands and configuration files
/usr/bin (Mysqladmin, mysqldump and other commands)

centos6.5 installing MySQL

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.