Linux下安装MySQL5.7.19遇到的问题

本文安装得MySQL版本为mysql-5.7.19

1.MySQL5.7版本之前安装MySQL用的是

./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

       而5.7版本之后使用的是

bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

2.使用initialize命令还是报错 error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory

 

 

解决办法:1.如果已经安装了libnuma.so.1,先$ yum remove libnuma.so.1

  2.$ yum install numactl.x86_64

3. [ERROR] --initialize specified but the data directory has files in it. Aborting.
[ERROR] Aborting

如果报这个错则是MySQL路径下的data文件夹里面有文件,删除干净即可

4. support-files路径下没有my-default.cnf文件就需要自己建,如下是我在网上找的,更改路径即可

 

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
 
[mysqld]
 
 
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
 
# 一般配置选项
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
socket = /var/run/mysqld/mysqld.sock
character-set-server=utf8
 
 
back_log = 300
max_connections = 3000
max_connect_errors = 50
table_open_cache = 4096
max_allowed_packet = 32M
#binlog_cache_size = 4M
 
max_heap_table_size = 128M
read_rnd_buffer_size = 16M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size = 16
query_cache_size = 128M
query_cache_limit = 4M
ft_min_word_len = 8
 
thread_stack = 512K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 128M
#log-bin=mysql-bin
long_query_time = 6
 
 
server_id=1
 
innodb_buffer_pool_size = 1G
innodb_thread_concurrency = 16
innodb_log_buffer_size = 16M
 
 
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = on
 
[mysqldump]
quick
 
max_allowed_packet = 32M
 
[mysql]
no-auto-rehash
default-character-set=utf8
safe-updates
 
[myisamchk]
key_buffer = 16M
sort_buffer_size = 16M
read_buffer = 8M
write_buffer = 8M
 
[mysqlhotcopy]
interactive-timeout
 
[mysqld_safe]
open-files-limit = 8192
 
[client]
/bin/bash: Q: command not found

 

5.开启服务service mysql start 

 ERROR! The server quit without updating PID file 

这里就要删除my.cnf文件

$ rm /etc/my.cnf

  $ /etc/init.d/mysql start

MySQL即可正常开启

6.下面即可登录 

$   ./bin/mysql -u root -p

输入刚刚记录下来的临时密码即安装和初始化数据库 步奏产生的密码

变为mysql>即安装成功

初次登录必须要修改密码     set password = password('123456');

 

下面便可以正常操作了

最后需要远程连接的话则还要

 

mysql>grant all privileges on *.* to root@'%' identified by '你的密码';

mysql>flush privileges;

mysql>use mysql;

mysql>select host,user from user;

 

远程链接数据库,或者重启。

 至此全部完成

 

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值