centos 5.8 mysql安装_centos 5.8 64位系统安装 mysql5.6

yum -y install make gcc-c++ bison-devel  ncurses-devel //安装mysql所需要的依赖包

groupadd mysql(增加mysql用户组)

useradd-g mysql -s /sbin/nologin mysql(增加mysql用户 不允许直接登录)

tar-zxvf mysql-5.6.26.tar.gz

cdmysql-5.6.26cmake.

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql

-DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1(cmake 编译mysql)

make

make install

make cleanchown -R mysql:mysql /usr/local/mysqlchmod755 /usr/local/mysql/scripts/mysql_install_db (赋给文件执行权限) /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysqldchmod 755 /etc/init.d/mysqld

chkconfig--add mysqld

chkconfig mysqld on

编辑 /etc/init.d/my.cnf //mysql的配置文件写入如下内容 根据实际情况修改

#########################################################

[client]

default-character-set = utf8

port = 3306

socket = /tmp/mysql.sock

[mysqld]

socket=/tmp/mysql.sock

port = 3306

basedir = /usr/local/mysql

datadir=/www/mysql/data

pid-file = /www/mysql/data/mysql.pid

user = mysql

bind-address = 0.0.0.0

server-id = 1

skip-name-resolve

back_log = 600

max_connections = 1000

max_connect_errors = 6000

open_files_limit = 65535

table_open_cache = 128

max_allowed_packet = 4M

binlog_cache_size = 1M

max_heap_table_size = 8M

tmp_table_size = 16M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

sort_buffer_size = 8M

join_buffer_size = 8M

key_buffer_size = 4M

thread_cache_size = 8

query_cache_size = 8M

query_cache_limit = 2M

ft_min_word_len = 4

log_bin = mysql-bin

binlog_format = mixed

expire_logs_days = 30

log_error = /www/mysql/data/mysql-error.log

slow_query_log = 1

long_query_time = 1

slow_query_log_file = /www/mysql/data/mysql-slow.log

performance_schema = 0

explicit_defaults_for_timestamp

#lower_case_table_names = 1

skip-external-locking

default_storage_engine = InnoDB

#default-storage-engine = MyISAM

innodb_file_per_table = 1

innodb_open_files = 500

innodb_buffer_pool_size = 64M

innodb_write_io_threads = 4

innodb_read_io_threads = 4

innodb_thread_concurrency = 0

innodb_purge_threads = 1

innodb_flush_log_at_trx_commit = 2

innodb_log_buffer_size = 2M

innodb_log_file_size = 32M

innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 90

innodb_lock_wait_timeout = 120

bulk_insert_buffer_size = 8M

myisam_sort_buffer_size = 8M

myisam_max_sort_file_size = 10G

myisam_repair_threads = 1

interactive_timeout = 28800

wait_timeout = 28800

[mysqldump]

quick

max_allowed_packet = 16M

[myisamchk]

key_buffer_size = 8M

sort_buffer_size = 8M

read_buffer = 4M

write_buffer = 4M

##########################################################

service mysqld restart

添加到环境变量

vi/etc/profile

添加如下代码 export PATH="$PATH:/usr/local/mysql/bin"source/etc/profile

登录mysqlmysql -uroot -p //登陆mysql 第一次登陆的时候不需要输入密码

use mysql;

delete from user where User=''; //删除用户名为空的用户

UPDATE user SET password=PASSWORD("123456") WHERE user='root'; //修改root用户的密码

mysql增加用户的命令

grant all privileges on db_test.* to db_user@"%" identified by '123456'with grant option;

这样就为 数据库 db_test 增加了一个 db_user的用户操作的权限 默认密码为123456

flush privileges;//刷新权限

重启服务器,看mysql是否随着开机启动

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值