mysql-community社区版安装

发布时间:2020-05-25 16:41:13 作者:PowerMichael
来源:网络 阅读:1579
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 
#启动
]# 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'; 
推荐阅读:
  1. Mac下安装社区版MongoDB
  2. Centos7安装mysql社区版

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

mysql 安装 un

上一篇:MHA故障转移可以帮助我们解决什么问题

下一篇:mysql锁查询方式

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》