Linux上安装mysql步骤

阅读 418 标签:mysql  
1、上传下载好的安装包到指定目录
 
2、yum install libaio libaio-devel
 
3、yum -y install numactl
 
4、tar zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
 
5、mv mysql-5.7.21-linux-glibc2.12-x86_64 /usr/local/mysql57
 
6、groupadd mysql
 
7、useradd -r -g mysql mysql
 
8、[root@iZ25fpoaflxZ mysql57]# id mysql
uid=501(mysql) gid=502(mysql) groups=502(mysql)
 
9、[root@iZ25fpoaflxZ mysql57]# mkdir -p /data/mysql3306/data/
 
10、[root@iZ25fpoaflxZ mysql57]# chown -R mysql.mysql /data/mysql3306
 
11、[root@iZ25fpoaflxZ mysql57]# chmod 750 /data/mysql3306/data
 
12、[root@iZ25fpoaflxZ mysql57]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql57 --datadir=/data/mysql3306/data
 
2018-12-07T02:37:59.719825Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-12-07T02:38:00.653053Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-12-07T02:38:00.782312Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-12-07T02:38:00.853061Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 1d349e4b-f9c9-11e8-b82e-00163e106c1b.
2018-12-07T02:38:00.858277Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-12-07T02:38:00.858879Z 1 [Note] A temporary password is generated for root@localhost: IESd#EfJj4zr 注意:这是默认密码
 
13、[root@iZ25fpoaflxZ mysql57]# vim ./support-files/mysql.server
#填入
basedir=/usr/local/mysql57
datadir=/data/mysql3306/data
 
 
14、cp -a ./support-files/mysql.server /etc/init.d/mysqld
 
15、[root@iZ25fpoaflxZ mysql57]# vim /etc/my.cnf  直接复制下面内容 注意目录
[mysql]
prompt="\\u@mysql3306:\\p:[\\d] \\R:\\m:\\s>"
no-auto-rehash
default_character_set = utf8
user=zabbix
password=ZabbiX.mysql
socket=/tmp/mysql3306.sock
 
[mysqld]
socket=/tmp/mysql3306.sock
port=3306
user = mysql
pid-file = ai-mysql-005.pid
 
character_set_server = utf8
basedir=/usr/local/mysql57
datadir=/data/mysql3306/data
log_bin = /data/mysql3306/logs/mysql-bin
log-error = /data/mysql3306/data/error.log
tmpdir = /data/mysql3306/tmp
slow_query_log = 1
long_query_time = 2
lower_case_table_names=1
innodb_file_per_table=1
max_allowed_packet = 1024M
net_read_timeout = 86400
net_write_timeout = 86400
max_connections = 10000
max_user_connections = 0
thread_cache_size = 200
#tmp_table_size = 32M
#max_heap_table_size = 32M
tmp_table_size = 500M
max_heap_table_size = 500M
sort_buffer_size = 16M
join_buffer_size = 16M
read_rnd_buffer_size = 64M
read_buffer_size = 16M
wait_timeout = 300
interactive_timeout = 300
binlog_cache_size = 4M
expire_logs_days = 30
innodb_log_file_size = 256M
innodb_log_files_in_group = 2
innodb_buffer_pool_size = 1G
innodb_buffer_pool_instances=8
master_info_repository = table
relay_log_info_repository = table
server-id=2
slave-skip-errors = all
innodb_flush_log_at_trx_commit=1
sync_binlog=1
gtid-mode=on
enforce-gtid-consistency=1
binlog_format = ROW
transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
secure_file_priv=/tmp
slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=16
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log_recovery=ON
 
16、[root@iZ25fpoaflxZ mysql57]# touch /data/mysql3306/data/error.log
 
17、[root@iZ25fpoaflxZ mysql57]# mkdir /data/mysql3306/tmp
 
18、[root@iZ25fpoaflxZ mysql57]# mkdir /data/mysql3306/logs
 
19、[root@iZ25fpoaflxZ mysql57]# chown -R mysql.mysql /data/mysql3306
 
20、[root@iZ25fpoaflxZ mysql57]# service mysqld start
 
 
21、[root@iZ25fpoaflxZ mysql57]# ./bin/mysql -uroot -pq0lU5cch9l.R 注意密码
 
22、root@mysql3306:mysql3306.sock:[(none)] 10:52:24>set password=password("jack@2018");
Query OK, 0 rows affected, 1 warning (0.01 sec)
 
23、root@mysql3306:mysql3306.sock:[(none)] 10:53:41>grant all on *.* to 'root'@'localhost' identified by 'jack@2018';
Query OK, 0 rows affected, 1 warning (0.00 sec)
 
24、root@mysql3306:mysql3306.sock:[(none)] 10:54:34>grant all on *.* to 'root'@'%' identified by 'jack@2018';
Query OK, 0 rows affected, 1 warning (0.01 sec)
 
root@mysql3306:mysql3306.sock:[(none)] 10:54:49>
文章来源:网络 版权归原作者所有,如涉及知识产权问题,请权利人联系我们,我们将立即处理.
标签: mysql
上杉夏香
文章 101 获得 0个赞 共 0个粉丝

推荐阅读 更多精彩内容

  • 执行hive SQL 语句“ select out from XXX ” 时报错如下:Error: Error while compiling statement: FAILED: ParseExce
    空空姬 空空姬 阅读 226 标签: 大数据  
  •   减肥其实就是一种习惯。生活中我们需要养成哪些习惯帮助我们快速减肥呢?下面是减肥达人分享的5个快速减肥妙招,想减肥的MM千万别错过哦!  第一,晚饭少吃,同时减掉晚饭的主食。晚饭是肥胖的主要敌人,晚
  •   瑜伽凳子在瑜伽习练当中,被用作是最佳的辅助工具,很多瑜伽人在开始练习瑜伽之前,都会购买一张甚至是多张瑜伽,来辅助完成瑜伽的习练。  在瑜伽馆当中,瑜伽砖是常见的必备瑜伽辅具,而瑜伽凳子,就是进阶的
    空空姬 空空姬 阅读 446
  •   想要提高减肥速度,让你瘦得比别人更快吗?  你需要远离节食减肥的误区,远离水果代餐的误区,做到科学减肥,迈开腿、管住嘴提高身体的卡路里摄入,才能让你科学、健康的瘦下来,降低复胖几率。  减肥的人,
    田井中律 田井中律 阅读 308
  •   拥有完美的身材是所有女性的梦想,在实际的生活里很多的女性朋友为了减肥都拼命的节食、运动,减肥达人告诉我们其实在生活中只要养成一些良好的作息习惯,体重慢慢的都会降下来的,最常见的就是睡前喝点东西,睡
  •   一到夏天,就到了露肉的季节,大家就又开始了每年的必修课程——减肥,而大部分人减肥都是通过节食和运动来完成的。减肥有哪些误区呢?科学的减肥方法是什么?减肥的人晚上吃什么会比较合适呢?小编带你一起了解
  •   其实我们都知道,如果是身体特别肥胖的情况下,真的是非常非常的,肯定会引起一些高血压等也会出现糖尿病的,而且肥胖都是因为内脏脂肪惹的祸,有两个方法可以轻轻松松的减掉,这个脂肪瘦下来的,到底有什么方法
  •   很多的人在减脂的过程中通常都会下意识的使用节食这个方式,去让自己身体的脂肪减少。但是,通过这样的方式让自己变瘦了,我们减少的体重中,有60%是肌肉,而脂肪只占有40%。  所以,想通过节食来进行减
  •   胖,是人们讨厌的东西,因为肥胖不仅意味着身体走形,还意味着各种疾病的发生,高血压,高血脂,脂肪肝,这种病最容易和肥胖挂钩。所以人们总是会想到减肥,可是减肥和什么有关呢,小编告诉你,是和内脏脂肪多,
    空空姬 空空姬 阅读 427
  •   对于减脂餐,我认为并不是全部都要是素食,而应该荤素搭配,既能保证营养,又能避免自己挨饿,毕竟我是一个无肉不欢的人。所以在制作减脂餐时,尝试了不同食材的搭配,发现涮火锅用的羊肉片用来做减脂餐也是不错