centos7安装MYSQL

centos7安装MYSQL

yum install mysql
yum install mysql-devel

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

安装后重启MYSQL

 service mysqld restart

远程访问CENTOS的MYSQL数据库设置

mysql -u root 

grant all privileges on *.* to root@'%'identified by 'root';  
后面的root是root用户的密码
grant all privileges on *.* to root@'localhost'identified by 'root';  

mysql -u root -p 

CENTOS设置MYSQL字符集

show variables like 'character_set%';

vim etc/my.cnf

修改成如下:

[client] 
port=3306 
socket=/var/lib/mysql/mysql.sock 
default-character-set=utf8 

[mysqld] 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 
user=mysql 
# Disabling symbolic-links is recommended to prevent assorted security risks 
symbolic-links=0 
character-set-server=utf8 

[mysql] 
no-auto-rehash 
default-character-set=utf8 

[mysqld_safe] 
log-error=/var/log/mysqld.log 
pid-file=/var/run/mysqld/mysqld.pid

重启mysql服务:service mysqld restart

权限

SHOW GRANTS;

grant create routine on mysql.* to root;
flush privileges;

grant execute on mysql.* to root;
flush privileges;

grant alter routine on mysql.* to root;
flush privileges;

delimiter $

CREATE PROCEDURE sp_test()
BEGIN
SELECT * FROM t1;
END;


posted @ 2017-09-07 16:54  delphi中间件  阅读(325)  评论(0编辑  收藏  举报