CentOS Yum编译安装MySQL 5.6
程序员文章站
2023-11-10 16:09:34
本文实例为大家分享了centos yum安装mysql 5.6的具体代码,供大家参考,具体内容如下
1.检查系统是否安装其他版本的mysql数据...
本文实例为大家分享了centos yum安装mysql 5.6的具体代码,供大家参考,具体内容如下
1.检查系统是否安装其他版本的mysql数据
#yum list installed | grep mysql #yum -y remove mysql-libs.x86_64
2.安装及配置
# 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
3.设置远程root
启动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;
4.设置utf-8编码
查看mysql原本编码:
mysql> show variables like 'character%';
设置编码
# vi /etc/my.cnf
如下(少补):
[mysqld] character-set-server=utf8 collation-server=utf8_general_ci [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
再次查看编码:
# mysql -uroot -p mysql> show variables like 'character%'; +--------------------------+----------------------------+ | 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/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec)
5.加入环境变量,编辑 /etc/profile,这样可以在任何地方用mysql命令
export path=$path:/usr/local/mysql//bin<br>source /etc/profile
精彩专题分享:mysql不同版本安装教程 mysql5.7各版本安装教程 mysql5.6各版本安装教程
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
推荐阅读
-
CentOS Yum编译安装MySQL 5.6
-
CentOS 6.2编译安装Nginx1.0.14+MySQL5.5.22+PHP5.3.10步骤分享
-
阿里云centos7使用yum安装mysql的正确姿势(推荐)
-
centos6.5下mysql 5.7.19 安装配置方法
-
阿里云Centos 7.5安装Mysql的教程
-
CentOS 7下使用rpm包安装mysql 5.7.18
-
linux(Centos7)下安装mysql8.0.18的教程图解
-
centOS7安装mysql8.0完美教程!!只要按照步骤,无脑操作,一次成功!
-
【原创】CentOS 7 安装解压版mysql5.7
-
CentOS 7.5 yum 安装 Zabbix