rpm -ivh mysql-community-common-8.0.13-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.13-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.13-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.13-1.el7.x86_64.rpm
mysqld --initialize
#获取密码
grep "root@localhost" /var/log/mysqld.log |awk -F" " '{print $NF}'
#保存密码
echo -e "root\t$(grep "root@localhost" /var/log/mysqld.log |awk -F" " '{print $NF}')" >> /root/.mysql_passwd
3.修改mysql db的charset为utf-8
创新互联公司长期为上千多家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为鸡泽企业提供专业的成都网站设计、网站建设,鸡泽网站改版等技术服务。拥有十多年丰富建站经验和众多成功案例,为您定制开发。cat >> /etc/my.cnf <
#启动
]# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
#查看日志,ibdata1没有写权限
vim /var/log/mysqld.log
2018-12-26T02:51:14.894580Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2018-12-26T02:51:14.894641Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
#修改所有mysql目录及文件属主为mysql
chown -R mysql. /var/lib/ mysql*
#再次启动,成功
systemctl start mysqld
#查看状态
]# systemctl status mysqld
?.mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2018-12-26 10:57:21 CST; 4min 11s ago
-- 创建账号、分配权限
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION
-- 修改密码,使数据库可以连接Navicat
ALTER USER 'user'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
-- 刷新权限
FLUSH PRIVILEGES;
-- 显示账号及权限相关信息
SHOW GRANTS FOR 'user'@'localhost';
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。