mysql从5.5之后源码安装需要使用cmake:
To install MySQL from source, your system must have the following tools, regardless of installation method:
-
CMake, which is used as the build framework on all platforms.CMake can be downloaded fromhttp://www.cmake.org.
-
A good make program. Although some platforms come with their ownmake implementations, it is highly recommended that you
use GNUmake 3.75 or newer. It may already be available on your system asgmake. GNUmake is available fromhttp://www.gnu.org/software/make/.
-
A working ANSI C++ compiler. GCC 4.2.1 or later, Sun Studio 10 or later, Visual Studio 2008 or later, and many current vendor-supplied compilers are known to work.
-
Perl is needed if you intend to run test scripts. Most Unix-like systems include Perl. On Windows, you can use a version such as ActiveState Perl.
yum 安装 gcc,gcc-c++,cmake,bison(GNU),使用 centos6.0 自带的perl和openssl
添加mysql组和mysql用户
/usr/sbin/groupaddmysql
/usr/sbin/useradd-gmysqlmysql
将mysql和data文件安装到不同的物理磁盘上
cmake -DCMAKE_INSTALL_PREFIX=/opt/soft/mysql \
-DMYSQL_DATADIR=/home/soft/mysql/data \
-DMYSQL_UNIX_ADDR=/opt/soft/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_EMBEDDED_SERVER=0 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0 \
-DWITH_SSL=yes
报错:
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:82 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu , package name is libncurses5-dev ,
on
RedHat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:126 (FIND_CURSES)
cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:256 (MYSQL_CHECK_READLINE)
-- Configuring incomplete, errors occurred!
=======================
没有安装 ncurses-devel
yum安装之后 还是报错,找运维高手才知道 cmake会产生CMakeCache.txt文件,每次cmake之前需要删除它....
ok,一切正常
echo $?
输出结果为0
make
make install
安装成功
chown mysql:mysql /home/soft/mysql -R
chown mysql:mysql /opt/soft/mysql/ -R
初始化数据库
cd /opt/soft/mysql/
/opt/soft/mysql/scripts/mysql_install_db \--defaults-file=/opt/soft/mysql/config/my.cnf \ --basedir=/opt/soft/mysql\ --datadir=/home/soft/mysql/data \ --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h c60h.localdomain password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
===============================
之所以要安装mysql5.5.16是想将Percona-5.5.16中的xtraDB安装到mysql中,替换了storage中的innobase,结果make步骤中报错,只能是单独安装Percona了.
=================================
启动
/opt/soft/mysql/bin/mysqld_safe --defaults-file=/opt/soft/mysql/config/my.cnf --user=mysql &
[1] 25812
# 111031 13:18:55 mysqld_safe Logging to '/home/soft/mysql/data/c60h.localdomain.err'.
111031 13:18:55 mysqld_safe Starting mysqld daemon with databases from /home/soft/mysql/data
^C
# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:50341 0.0.0.0:* LISTEN 1409/rpc.statd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 26217/mysqld
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1340/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1619/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1121/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1695/master
tcp 0 52 192.168.161.141:22 192.168.161.1:54674 ESTABLISHED 1820/sshd: admin [p
tcp 0 0 :::42759 :::* LISTEN 1409/rpc.statd
tcp 0 0 :::111 :::* LISTEN 1340/rpcbind
tcp 0 0 :::22 :::* LISTEN 1619/sshd
tcp 0 0 ::1:631 :::* LISTEN 1121/cupsd
配置mysql用户
/opt/soft/mysql/bin/mysqladmin -u root password 123456
/opt/soft/mysql/bin/mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
/opt/soft/mysql/bin/mysql -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.16-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host,user,password from user;
+------------------+------+-------------------------------------------+
| host | user | password |
+------------------+------+-------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| c60h.localdomain | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| c60h.localdomain | | |
+------------------+------+-------------------------------------------+
6 rows in set (0.00 sec)
mysql> delete from user where LENGTH(password)<10;
Query OK, 5 rows affected (0.00 sec)
mysql> select host,user,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+-----------+------+-------------------------------------------+
1 row in set (0.00 sec)
mysql> grant all on *.* to 'admin'@'192.168.%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host,password from user;
+-------+-----------+-------------------------------------------+
| user | host | password |
+-------+-----------+-------------------------------------------+
| root | localhost | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| admin | 192.168.% | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+-------+-----------+-------------------------------------------+
2 rows in set (0.00 sec)
===================
root用户只能本机登陆
admin 只能局域网登陆
==============================
开启 3306 端口
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables restart
重启 iptables 生效
========================
配置文件
cat config/my.cnf
[client]
#password = your_password
port = 3306
socket = /opt/soft/mysql/mysql.sock
default-character-set = utf8
[mysql]
default-character-set = utf8
[mysqld]
character-set-server = utf8
datadir = /home/soft/mysql/data
tmpdir = /dev/shm
port = 3306
socket = /opt/soft/mysql/mysql.sock
pid-file = /opt/soft/mysql/601.localdomain.pid
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K
default-storage-engine = innodb
innodb_buffer_pool_size = 128M
innodb_data_home_dir = /home/soft/mysql/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /opt/soft/mysql/log
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_lock_wait_timeout = 60
innodb_flush_log_at_trx_commit = 2
#skip-networking
server-id = 601
log-slave-updates
log-bin = /opt/soft/mysql/binlog/mysql-bin
relay-log = /opt/soft/mysql/binlog/mysql-relay-bin
#binlog_format=mixed
# Causes updates to non-transactional engines using statement format to be
# written directly to binary log. Before using this option make sure that
# there are no dependencies between transactional and non-transactional
# tables such as in the statement INSERT INTO t_myisam SELECT * FROM
# t_innodb; otherwise, slaves may diverge from the master.
#binlog_direct_non_transactional_updates=TRUE
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysqladmin]
#socket = /home/mysql/data/mysql.sock
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
[mysqlhotcopy]
interactive-timeout
分享到:
相关推荐
CentOS 7 安装 MySQL
centos 下hive连接mysql驱动 ,mysql-connector-java-8.0.26-1.el7.noarch. 使用方法: 1.下载本rpm文件后,上传至你的服务器(虚拟机) 2. rpm -ivh mysql-connector-java-8.0.26-1.el7.noarch进行安装 3.安装完成...
centOS 6.5 安装 mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
内容: 1、centos 6 安装 mantisbt-1.2.8 ; 2、 centos 7 安装 mantisbt-2.12.0.zip 3、mantisbt-2.12.0.tar.gz包; 4、MySQL-5.5.59-1.el7.x86_64.rpm-bundle.tar包
新版本的 cmake: cmake-3.13.4-win64-x64.msi Make是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程)。
总之,CentOS7上安装MySQL和mysqlclient虽然有一些潜在的陷阱,但通过理解安装过程、熟悉配置文件和权限设置,以及善于查找资源和解决问题,这些挑战是可以克服的。在日常维护和管理MySQL服务器时,也要持续关注安全...
《CentOS7环境下MySQL社区版5.7.33的离线安装详解》 在Linux系统中,MySQL数据库是常用的关系型数据库管理系统,尤其在服务器环境中应用广泛。本篇文章将详细解析如何在 CentOS7 64位操作系统上,通过离线方式安装 ...
CentOS6-Mysql-5.7.28-离线安装包(含依赖安装包)CentOS6-Mysql-5.7.28-离线安装包(含依赖安装包)CentOS6-Mysql-5.7.28-离线安装包(含依赖安装包)
离线环境下,在centos7.6系统上安装docker-ce-19.03,nvidia-docker2.4版本,其中docker-ce-19.03在docker-local.tar压缩文件里面,nvidia-docker2在nvidia-docker2.zip文件中。 具体安装流程如下: 1.安装docker ...
通过以上步骤,您可以在CentOS 6.0系统上成功安装并配置MySQL 5.1.59版本。请注意,实际操作过程中可能遇到各种问题,如权限问题、依赖问题等,需要根据具体情况进行调试解决。此外,在正式环境中部署MySQL时,还...
zabbix5安装文档-centos7.8-mysql5.7-nginx;zabbix5安装文档-centos7.8-mysql5.7-nginx
cmake-2.6.4-5.el6.i686.rpm是centos工具包。
在本案例中,我们讨论的是"cmake-3.9.1-linux-x86_64.tar.gz",这是一个针对Linux x86_64架构的CMake版本3.9.1的打包文件,适用于CentOS这样的Linux发行版。 在CentOS中安装CMake通常涉及以下步骤: 1. **解压文件...
linux-centos7-mysql-5.7.36-linux-glibc2,数据库,集群数据库
CentOS 7 安装 MySQL 5.7.28 详细完整教程 MySQL 是一种关系型数据库管理系统,广泛应用于各种 Web 应用程序中。在本教程中,我们将详细介绍如何在 CentOS 7 中安装 MySQL 5.7.28。 知识点1:下载 MySQL 源 在...
CentOs7 下 Mysql 5.7 的下载安装和主从同步、双主多从配置详解 CentOs 7 是一个流行的 Linux 操作系统,而 Mysql 5.7 是一个广泛使用的关系型数据库管理系统。本文将详细介绍如何在 CentOs 7 下下载安装 Mysql 5.7...
mkdir -p /usr/local/mysql #创建MySQL安装目录 cd /usr/local/src #进入软件包存放目录 tar zxvf mysql-5.6.19.tar.gz #解压 cd mysql-5.6.19 #进入目录 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -D...
mysql-workbench-community-8.0.19.rpm 完整安装包(含依赖) 包含以下内容: libzip-0.10.1-8.el7.x86_64.rpm mesa-libGLU-9.0.0-4.el7.x86_64.rpm mysql-workbench-community-8.0.19-1.el7.x86_64.rpm tinyxml-...
arm架构centos7 下mysql8离线安装包 包含: mysql-community-client-8.0.20-1.el7.aarch64.rpm mysql-community-common-8.0.20-1.el7.aarch64.rpm mysql-community-devel-8.0.20-1.el7.aarch64.rpm mysql-community-...
本文将详细阐述如何在 CentOS7 操作系统上安装 MySQL 社区版,以及如何管理和配置MySQL数据库,同时也会涉及到CentOS7的防火墙设置。 首先,我们来关注安装MySQL的过程。在 CentOS7 上安装 MySQL 社区版,需要通过 ...