第二节 网络配置和MySQL安装

选择net模式:使用命令 vi /etc/sysconfig/network-scripts/ifcfg-eth0 将ONBOOT=no改为ONBOOT=yes
然后使用命令 service network restart 重启网卡,即可连接网络

一、检查系统是否安装其他版本的MYSQL数据
1 # yum list installed | grep mysql
2 # yum -y remove mysql-libs.x86_64
二、安装及配置
1 # wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
2 # rpm -ivh mysql-community-release-el6-5.noarch.rpm
3 # yum repolist all | grep mysql
安装MYSQL数据库
1 # yum install mysql-community-server -y
设置为开机启动(2、3、4都是on代表开机自动启动)
1 # chkconfig --list | grep mysqld
2 # chkconfig mysqld on
三、设置远程root
启动mysql
1 # service mysqld start
设置root密码
1 # mysql_secure_installation
登录root账号
1 # mysql -uroot -p 
建立远程root用户
1 mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你设置的密码' WITH GRANT OPTION;
2 mysql> flush privileges;
四、设置utf-8编码
查看mysql原本编码:
1 mysql> show variables like 'character%';
设置编码 vi /etc/my.cnf
复制代码
 1 [mysqld]
 2 character-set-server=utf8 
 3 collation-server=utf8_general_ci 
 4 performance_schema_max_table_instances=400 
 5 table_definition_cache=400 
 6 table_open_cache=256
 7 # 修改
 8 sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 9 
10 [mysql]
11 default-character-set = utf8
12 
13 [mysql.server]
14 default-character-set = utf8
15 
16 
17 [mysqld_safe]
18 default-character-set = utf8
19 
20 
21 [client]
22 default-character-set = utf8
复制代码

重启mysql

1 # service mysqld restart

再次查看编码:

复制代码
 1 mysql> show variables like 'character%';
 2 +--------------------------+----------------------------+
 3 | Variable_name | Value |
 4 +--------------------------+----------------------------+
 5 | character_set_client | utf8 |
 6 | character_set_connection | utf8 |
 7 | character_set_database | utf8 |
 8 | character_set_filesystem | binary |
 9 | character_set_results | utf8 |
10 | character_set_server | utf8 |
11 | character_set_system | utf8 |
12 | character_sets_dir | /usr/share/mysql/charsets/ |
13 +--------------------------+----------------------------+
14 8 rows in set (0.00 sec)
转自:https://www.cnblogs.com/pan-louis/p/11004087.html
如侵权请联删
原文地址:https://www.cnblogs.com/kogmaw/p/12409705.html