mysql5.7.30安装包安装教程_mysql5.7.30编译安装
⾸先安装/更新⼀些编译时会⽤到的基础包
[root@localhost local]#yum -y install gcc gcc-c++ make cmake ncurses ncurses-devel libxml2 libxml2-devel openssl-devel bison bison-devel
官⽹下载mysql 5.7.30版本源码包
编译安装mysql 5.7.30的版本需要gcc⽀持c++11,不懂的朋友可以看我另外⼀篇⽂章:源码安装GCC-4.9.2
1、创建mysql⽤户
[root@localhost local]#groupadd mysql
python基础入门夏敏捷pdf[root@localhost local]#useradd -s /sbin/nologin -g mysql -M mysql #不允许mysql⽤户登录
2、创建数据存放⽬录
[root@localhost local]# mkdir -pv /data/dbdata
[root@localhost local]# mkdir -pv /data/innodb
[root@localhost local]#chown -sql /data/ #修改⽬录权限为mysql
3、安装mariadb
#官⽹下载boost⽂件,解压到当前⽬录
# 在mysql路径下添加bld⽂件夹,将编译的⽂件放在这个⽂件夹⾥ mysql-5.7.30
[root@localhost mysql-5.7.30]# mkdir bld
[root@localhost mysql-5.7.30]#
cmake .. -DMYSQL_UNIX_ADDR=/tmp/mysql.sock\
my sql数据库介绍-DSYSCONFDIR=/usr/local/mysql\
-DMYSQL_TCP_PORT=3306\
-DEXTRA_CHARSETS=all\
-
DMYSQL_USER=mysql\
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\
-DMYSQL_DATADIR=/data/mysql/dbdata\
-DWITH_XTRADB_STORAGE_ENGINE=1\
-DWITH_FEDERATEDX_STORAGE_ENGINE=1\
-DWITH_ARCHIVE_STORAGE_ENGINE=1\
-DWITH_MYISAM_STORAGE_ENGINE=1\
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DWITH_ARCHIVE_STPRAGE_ENGINE=1\
-DWITH_BLACKHOLE_STORAGE_ENGINE=1\
-DWIYH_READLINE=1\
-
DWIYH_SSL=system\
-DVITH_ZLIB=system\
c语言递归题-DWITH_LOBWRAP=0\
-DWITH_BOOST=/usr/local/src/mysql-5.7.30/boost/boost_1_59_0/\
-DDEFAULT_CHARSET=utf8mb4\
-DDEFAULT_COLLATION=utf8mb4_general_ci
[root@localhost mysql-5.7.30]# make
[root@localhost mysql-5.7.30]# make install
到这⾥MariaDB已经算是安装上了,进⾏配置就可以使⽤了。本⼈在这⾥⽤的是多实例配置⽅法1、配置⽂件
# 修改myf⽂件spring boot常用注解及作用
# The MySQL server
[mysqld]
user=mysql
port = 3306
#bind-address = 127.0.0.1
socket = /tmp/mysql.sock
# skip-grant-tables
datadir = /data/mysql/dbdata
pid-file = /data/mysql/dbdata/my.pid
skip-external-locking
skip-name-resolve
interactive_timeout=86400
wait_timeout=86400
key_buffer_size = 384M
max_allowed_packet = 4M
table_open_cache = 1024
table_definition_cache = 1024
table_open_cache_instances = 32
sort_buffer_size = 2M
read_buffer_size = 2M
myisam_sort_buffer_size = 64M
thread_cache_size = 32
query_cache_size = 64M
max_connections = 150
max_connect_errors=400
max_heap_table_size = 64M
item is nullopen_files_limit=2048
slow_query_log = 1
long_query_time = 2
slow-query-log-file = /data/mysql/dbdata/slowquery.sql
log-bin = /data/mysql/dbdata/replication
server-id = 100
log-slave-updates
skip-slave-start
character-set-server = utf8mb4
collation_server = utf8mb4_general_ci
master-info-file = /data/dbdata/master.info
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /data/mysql/innodb
innodb_data_file_path = ibdata1:200M;ibdata2:200M;ibdata3:200M;ibdata4:200M;ibdata5:200M innodb_log_group_home_dir = /data/mysql/innodb/
innodb_buffer_pool_size = 700M
innodb_log_file_size = 256M
innodb_log_buffer_size = 32M
innodb_flush_log_at_trx_commit = 0
mysql入门基础教程innodb_lock_wait_timeout = 50
default_storage_engine = innodb
2、初始化数据⽬录
#把⽤到的⼯具添加到/usr/bin⽬录
[root@localhost mysql]#ln -s /usr/local/mysql/scripts/mysql_install_db /usr/bin/mysql_install_db [root@localhost mysql]#./scripts/mysql_install_db --datadir=/data/dbdata --user=mysql
3、启动数据库
#将/usr/local/mysql/bin加到$PATH环境变量⾥
[root@localhost mysql]# vi /etc/profile
export PATH=/usr/local/mysql/bin:$PATH #插⼊到最后⼀⾏
#启动mysql
[root@localhost mysql]#cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql]#service mysqld start
在启动的时候会加载innodb,中途不能重启,否则会出现如下错误
151114 00:59:38 mysqld started
151114 0:59:38 [Warning] option 'thread_stack': unsigned value 126976 adjusted to 131072
InnoDB: No valid checkpoint found.
InnoDB: If this error appears when you are creating an InnoDB database,
InnoDB: the problem may be that during an earlier attempt you managed
InnoDB: to create the InnoDB data files, but log file creation failed.
InnoDB: If that is the case, please refer to
151114 0:59:38 [ERROR] Default storage engine (InnoDB) is not available
151114 0:59:38 [ERROR] Aborting
151114 0:59:38 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
151114 00:59:38 mysqld ended
删除innodb⽂件夹,重新启动就可以了
# mysql5.7.30 错误集锦
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.上⾯这个错误是由于 mysql没有初始化密码,执⾏以下语句即可
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysql192' PASSWORD EXPIRE NEVER;
mysql> flush privileges;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论