美文网首页
Centos6.5安装mysql

Centos6.5安装mysql

作者: 一纸繁鸢w | 来源:发表于2019-01-10 12:49 被阅读0次

因为mysql数据库在Linux上实在是太流行了,所以目前下载的主流Linux系统版本基本上都集成了mysql数据库在里面,我们可以通过如下命令来查看我们的操作系统上是否已经安装了mysql数据库

1. 卸载原有mysql

[root@bY ~]# rpm -qa | grep mysql    //查看是否已有mysql
[root@bY ~]# rpm -e --nodeps mysql*    //删除已有的mysql

2. 通过yum安装mysql

yum install -y mysql-server    //yum安装,需要外网环境

3. 启动mysql

service mysqld start/stop/restart/status

4. 初次使用,请设置MySQL密码

mysqladmin -u root password "123456"

5. 配置远程连接

mysql -uroot -p123456    //连接mysql
use mysql    //选择mysql数据库
update user set host='%',password=password('123456') where host='127.0.0.1';    //配置远程访问
flush privileges; #刷新权限

注意:防止mysql本地客户端数据乱码

/etc/my.cnf 中添加如下配置,即可
[client]
default-character-set=utf8
[mysqld]
default-storage-engine=InnoDB
sql_mode=STRICT_TRANS_TABLES

相关文章

网友评论

      本文标题:Centos6.5安装mysql

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