mysql单机版_单机版的mysql安装

查是否安装了mysql:

centos6:

rpm -qa |grep mysql

centos7:

rpm -qa|grep mariadb

或rpm -qa |grep mysql

有老的版本可以执行命令卸载:

rpm -e --nodeps mysql-libs

1、设置源

cat > /etc/yum.repos.d/mysql-community-el7.repo<

[mysql57-community]

name=MySQL 5.7 Community Server

baseurl=http://mirror.tuna.tsinghua.edu.cn/mysql/yum/mysql57-community-el7/

enabled=1

gpgcheck=0

EOF

2. 安装mysql

yum install mysql-community-server -y

systemctl restart mysqld

# mysqld.log中查询密码

grep password /var/log/mysqld.log

2019-04-09T07:28:44.292450Z 1 [Note] A temporary password is generated for root@localhost: wg:V45ci4ljpz!r

3.改/etc/my.cnf

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

transaction-isolation = READ-COMMITTED

# Disabling symbolic-links is recommended to prevent assorted security risks;

# to do so, uncomment this line:

symbolic-links = 0

character-set-server=utf8 #设置默认字符格式

key_buffer_size = 32M

max_allowed_packet = 32M

thread_stack = 256K

thread_cache_size = 64

query_cache_limit = 8M

query_cache_size = 64M

query_cache_type = 1

max_connections = 550

#expire_logs_days = 10

#max_binlog_size = 100M

#log_bin should be on a disk with enough free space.

#Replace '/var/lib/mysql/mysql_binary_log' with an appropriate path for your

#system and chown the specified folder to the mysql user.

#log_bin=/var/lib/mysql/mysql_binary_log #如主从需打开

#In later versions of MySQL, if you enable the binary log and do not set

#a server_id, MySQL will not start. The server_id must be unique within

#the replicating group.

#server_id=1 #如主从需打开

#binlog_format = mixed #如主从需打开

read_buffer_size = 256M #并发多可调大

read_rnd_buffer_size = 64M

sort_buffer_size = 64M

join_buffer_size = 64M

# InnoDB settings

innodb_file_per_table = 1

innodb_flush_log_at_trx_commit = 2

innodb_log_buffer_size = 64M

innodb_buffer_pool_size = 2G #并发多可调大

innodb_thread_concurrency = 8

innodb_flush_method = O_DIRECT

innodb_log_file_size = 512M

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

sql_mode=STRICT_ALL_TABLES

4.重启

#登陆后修改成自己的密码:

mysql> alter user user() identified by 'test123456';

5、 查看授权情况

select user,host from mysql.user;

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值