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 insensitiveAdd: 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)