码迷,mamicode.com
首页 > 数据库 > 详细

Centos安装mysql5.6.33

时间:2018-11-17 11:58:55      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:pre   profile   socket   for   pad   update   lang   tween   action   

下载安装包

  百度网盘地址:

    链接:https://pan.baidu.com/s/15xaHIqvjggS_rFP_jL-BVA 

    提取码:mh48

上传到服务器

  mkdir mysql   #在/usr/local/目录下创建mysql文件夹

  使用rz命令上传到/usr/local/mysql/目录下

  tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz  #解压

  mv mysql-5.6.33-linux-glibc2.5-x86_64 mysql   #重命名文件夹为mysql

安装mysql

groupadd mysql  #创建mysql用户组
useradd -g mysql mysql  #创建mysql用户并添加到mysql用户组
cp mysql/support-files/my-default.cnf /etc/my.cnf   #创建my.cnf文件
vim /etc/my.cnf  #编辑my.cnf文件

下面是我的my.cnf文件内容
  
我的配置如下
[mysqld]
init_connect=‘SET collation_connection = utf8_unicode_ci‘
init_connect=‘SET NAMES utf8‘
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir =/usr/local/mysql/

datadir = /usr/local/mysql/data

log-error = /usr/local/mysql/data/error.log

pid-file = /usr/local/mysql/data/mysql.pid

user = mysql

tmpdir = /tmp
#datadir = .....
port =3306
# server_id = .....
# socket = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
cd /usr/local/mysql/  #进入mysql目录
chown -R mysql:mysql ./    #修改当前目录拥有者为mysql
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/   #安装数据库
chown -R mysql:mysql data  #修改当前data目录的拥有者为mysql用户

配置mysql

chown 777 /etc/my.cnf  #给my.cnf最大权限
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld  #复制启动脚本到资源目录
chmod +x /etc/rc.d/init.d/mysqld  #增加mysql服务控制脚本执行权限
chkconfig --add mysqld  #将mysqld服务加到系统服务中
chkconfig --list mysqld  #检查mysqld服务是否已经生效

至此安装完成,使用 service mysqld start 启动mysql
vim ~/.bash_profile  #将mysql的bin目录加入PATH环境变量,编辑 ~/.bash_profile文件

在文件最后添加如下信息:export PATH=$PATH:/usr/local/mysql/bin

source ~/.bash_profile
#刷新一下
之后登陆mysql  mysql -uroot -p,默认是没有密码的,之后修改密码为root update user set password=password(‘root‘) where user=‘root‘ and host=‘localhost‘;

flush privileges;  #
之后允许远程连接远程连接的用户名和密码我设置为root

GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘root‘ WITH GRANT OPTION;


 
 

 

  

Centos安装mysql5.6.33

标签:pre   profile   socket   for   pad   update   lang   tween   action   

原文地址:https://www.cnblogs.com/xing-12/p/9973195.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!