美文网首页
CentOS 7.2 64位mysql 环境安装

CentOS 7.2 64位mysql 环境安装

作者: 青青河边踩 | 来源:发表于2017-11-09 12:56 被阅读26次

1、MySql 安装

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
yum install mysql-devel

2、启动MySql

启动MySQL:systemctl start mysql
设置开机自动启动:systemctl enable mysqld.service

3、登录mysql

mysql -uroot -p   (第一次启动,mysql 小于5.7 默认root账号没有密码,直接回车就行,5.7及以上可使用命名获取默认密码)

5.7及以上版本获取默认密码(获取后重新登录即可):
grep 'temporary password' /var/log/mysqld.log

4、设置密码

set password for 'root'@'localhost' =password('这里你要进入mysql的密码');

再次登录就需要你刚刚设置的密码了
5、远程访问,授权任何IP访问root 用户,如果新用户不是root,则需要创建账号后再授权

授权
grant all privileges on *.* to root@'%'identified by 'password';

创建账号
create user 'username'@'%' identified by 'password';

到这 MySQL 就装好了,我们也可以在本地用相关可视化工具连接数据库了,我用的是Sequel Pro,MySql的默认端口是3306


4C2355AE-DA2F-47A0-9433-ABF3D17DA8ED.png D3F366D6-2314-4F00-9235-3927AF39DFF8.png

相关文章

网友评论

      本文标题:CentOS 7.2 64位mysql 环境安装

      本文链接:https://www.haomeiwen.com/subject/criumxtx.html