单机版的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<<'EOF'
[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;
最新文章
- mvc过滤器学习(1)
- 你所不知道的linq
- android 一些常用开源框架
- C#委托与事件初探
- 弹层组件-layer
- mint安装相关数据库lib
- WPF combobox
- 对于c语言int类型和float,以及double类型表示范围的计算
- 20160824_CentOS6.4x64_关闭IPv6
- Event Logging
- jQuery选择器解释和说明
- ASP.NET文件上传的三种基本方法
- JavaSctipr 兼容、技巧、牛角尖
- MySQL在Windows和Linux减少数据库
- Lua的数学函数
- BOM定时器,onresize
- VS2017 MVC Spring net 环境配置
- LogParse-Windows系统日志分析
- 2018ICPC青岛 E - Plants vs. Zombies (二分+模拟)
- pandas 索引与列相互转化