centos 安装mysql

//安装mysql客户端

yum install mysql

//安装mysql 服务器端

yum install mysql-server

yum install mysql-devel

 

 mysql配置文件/etc/my.cnf中加入default-character-set=utf8

在[client]下添加

default-character-set=utf8

在[mysqld]下添加

default-character-set=utf8

 

 

 

service mysqld start或者/etc/init.d/mysqld start

 

chkconfig --add mysqld

 

chkconfig --level 35 mysqld on

 

chkconfig --list | grep mysql*

 

创建管理员用户

mysqladmin -u root password 密码

 

//登录

mysql -u root -p 

//输入密码

 

 

开启远程访问

use mysql;

update user set host = '%' where user = 'root';    //这个命令执行错误时可略过

flush privileges;

select host, user from user; //检查‘%’ 是否插入到数据库中

quit

查看字符集: show variables like '%char%'; 

  delete from user where user ='';

 delete from user where user is NULL;

你可能感兴趣的:(centos)