我爱编程

Linux下Mysql安装配置

2017-08-04  本文已影响67人  第八区

安装

#rpm -ivh MySQL-server-5.6.30-1.el6.x86_64.rpm
#rpm -ivh MySQL-client-5.6.30-1.el6.x86_64.rpm
#rpm -ivh MySQL-devel-5.6.30-1.el6.x86_64.rpm

安装目录说明

配置文件

为连接MySQL的主机分配权限:

命令如下:
>mysql GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO root@xxx.xxx.x.xx identified by '123456';
xxx.xxx.x.xx是你的IP

开机启动MySQL

用root用户登录终端
查看是否已经有MySQL的服务
#chkconfig --list
如果没有MySQL(如果有请忽略这个步骤)
#chkconfig --add mysql
设置开机启动mysql服务
#chkconfig mysql on

MySQL默认字符集

更改MySQL默认字符集 查看mysql字符集:
mysql> show variables like 'character_set_%';

修改物理文件位置

如果重启报错Starting MySQL...The server quit without updating PID file (/usr/local/mysql/data/rekfan.pid).。可能是selinux惹的祸,如果是centos系统,默认会开启selinux解决方法:
关闭它,打开/etc/selinux/config,把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器试试。

示例配置文件

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysql]
socket  = /home/data/mysql/mysql.sock
[mysqld]
port= 3306
 
socket  = /home/data/mysql/mysql.sock
datadir = /home/data/mysql

# 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 = .....
# datadir = .....
# port = .....
# 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 

 join_buffer_size = 256M
 sort_buffer_size = 128M
 read_rnd_buffer_size = 128M
 
 lower_case_table_names=1
 tmp_table_size = 256M
 max_connections = 1000
 max_connect_errors = 10000000
 wait_timeout = 1000000
  
 symbolic-links=0
  
 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
  
  
[client]
socket  = /home/data/mysql/mysql.sock
上一篇 下一篇

猜你喜欢

热点阅读