一、检查系统是否安装其他版本的MYSQL数据
#yum list installed | grep mysql
#yum -y remove mysql-libs.x86_64二、安装及配置
# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
# rpm -ivh mysql-community-release-el6-5.noarch.rpm
# yum repolist all | grep mysql安装MYSQL数据库
# yum install mysql-community-server -y设置为开机启动(2、3、4都是on代表开机自动启动)
# chkconfig --list | grep mysqld
# chkconfig mysqld on三、设置远程root
启动mysql
启动mysql
# service mysqld start设置root密码
# mysql_secure_installation登陆root账号
# mysql -uroot -p 建立远程root用户
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你设置的密码' WITH GRANT OPTION;
mysql> flush privileges;四、设置utf-8编码
查看mysql原本编码:
mysql> show variables like 'character%';设置编码# vi /etc/my.cnf如下(少补):[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
sql_mode='NO_ENGINE_SUBSTITUTION'
[mysql]
default-character-set = utf8
[mysql.server]
default-character-set = utf8
[mysqld_safe]
default-character-set = utf8
[client]
default-character-set = utf8重启mysql# service mysqld restart
开启防火墙端口
# firewall-cmd --zone=public --add-port=3306/tcp --permanent
# firewall-cmd --reload
# firewall-cmd --list-ports
安装与配置MySQL
本文详细介绍如何在Linux环境下安装并配置MySQL数据库,包括卸载旧版本、安装最新版本、设置开机启动、配置远程root用户、设置utf-8编码、开启防火墙端口等步骤。
1382

被折叠的 条评论
为什么被折叠?



