首先下载安装包至/OPT目录下
RPM Package, MySQL Server
RPM Package, Client Utilities
查看是否安装mysql
rpm -qa|grep mysql
若没有提示则未安装
出现如下错误需卸载系统自带依赖
warning: MySQL-server-5.5.62-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
file /usr/share/mysql/charsets/README from install of MySQL-server-5.5.62-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64
file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.5.62-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64
file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.5.62-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64
file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.5.62-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64
file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.5.62-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64
file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.5.62-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64
file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.5.62-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64
yum remove mysql-libs
安装命令
rpm -ivh MySQL-server-5.5.62-1.el7.x86_64.rpm
修改mysq密码
/usr/bin/mysqladmin -u root password 123456
设置开机启动
chkconfig mysql on
确认是否随开机自启
chkconfig --list|grep mysql
输入命令后的到如下提示
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
mysql 0:off1:off2:on3:on4:on5:on6:off
2,3,4,5表示启动级别,正常情况下启动mysql
复制配置文件
cp my-huge.cnf /etc/my.cnf
重启mysql
service mysql restart
修改字符集
先查看字符集
show variables like 'character%';
show variables like ‘’%char%';
在复制的my.cnf里面修改
[client]内添加
default-character-set=utf-8
[mysqld]内添加
character_set_server=utf8
character_set_client=utf8
collation-server=utf8_general_ci
[mysql]内添加
defaylt-character-set=utf8
重启mysql
支付宝扫一扫
微信扫一扫
企鹅扫一扫