By mounting the CentOS7 rpm MySQL5.5.54

1. Check to see over MySQL (mariadb version, if installed, uninstall, then install) Installation

   Command: rpm -qa | grep -i mariadb -i to ignore case

 

 

 

2. Uninstall MySQL; --nodeps exclude dependence, or other software relies mysql, can not be deleted

   Command: rpm -e --nodeps mariadb-libs

3. Install the MySQL client and server

   The installation program copied to the directory / opt.

   MySQL-server-5.5.54-1.linux2.6.x86_64.rpm

   MySQL-client-5.5.54-1.linux2.6.x86_64.rpm

3.1 Install Client

 

 

 3.2 server installation

 

 

 

 4. Check whether the installation is successful, it is necessary to increase the -i do not case sensitive, otherwise not search.

 

 

 5. Start mysql, and view status

 

 

 

6. The default root account has no password

 

 

 

7. Change Password / usr / bin / mysqladmin -u root password 'your password'

 

 

8. latin1 default character encoding is not supported Chinese

   show variables like 'character%'; 

 

 

 

9. Set utf8 character encoding, support for Chinese

Modify my.cnf

Copy in / usr / share / mysql / my-huge.cnf directory to / etc / my.cnf and rename the file name (Music Videos)

Then modify the my.cnf:

[client]

default-character-set=utf8

[mysqld]

character_set_server=utf8

character_set_client=utf8

collation-server=utf8_general_ci

[mysql]

default-character-set=utf8 

 

 

 

 

 

10. Restart mysql

     service mysql restart 

     But the setting does not change the original library, parameter changes take effect only for new database

 

已生成的库表字符集如何变更

修改数据库的字符集

mysql> alter database mydb character set 'utf8';

修改数据表的字符集

mysql> alter table mytbl convert to  character set 'utf8';

但是原有的数据如果是用非'utf8'编码的话,数据本身不会发生改变。

 

11.使用账户密码从任何主机连接到MySQL服务器----授权法(前提是开放了数据库的端口)

GRANT ALL PRIVILEGES ON . TO ‘myuser’@’%’ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;

Guess you like

Origin www.cnblogs.com/Dearmyh/p/12132344.html