1.我的环境
2.添加在线Mysql源
cd /etc/yum.repos.d/
# Enable to use MySQL 8.0
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/6/x86_64/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
3.验证
yum repolist enabled | grep mysql
如果想设置mysql数据库表名不区分大小写,一定要现在vi /etc/my.cnf 修改:
因为一旦数据库初始化完以后,该参数就无法修改了。
MySQL官方文档发现
lower_case_table_names can only be configured when initializing the server. Changing the lower_case_table_names setting after the server is initialized is prohibited.
4.YUM安装mysql
yum install -y mysql-community-common mysql-community-libs mysql-community-client mysql-community-server mysql-community-devel
启动Mysql服务
service mysqld start
查看MySQL服务器的状态
service mysqld status
设置开机启动
chkconfig mysqld on
生成随机密码
grep 'temporary password' /var/log/mysqld.log
重新登陆
mysql -uroot -p
b/xE8hdZoEwJ
配置Mysql 密码以及权限
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Report@123';
允许root用户在任何地方进行远程登录,并具有所有库任何操作权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
FLUSH PRIVILEGES;
疑难解答:
GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
第一种是把这个key从这个源站copy过来,放到/etc/pki/rpm-gpg目录下
第二种是修改repo文件
vim /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 – $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
把gpgcheck=1改为gpgcheck=0
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'WangJian2018@vtobank.com'
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。