Mysql 编译安装
来源:互联网 发布:java web框架排行 编辑:程序博客网 时间:2024/06/08 14:43
Mysql 编译安装
========================================
一:准备
1.1:源码下载
mysql 官网:http://dev.mysql.com/downloads/mysql/
github 地址:https://github.com/mysql/mysql-server
1.2:安装依赖
~]# yum -y install perl perl-devel autoconf cmake gcc gcc-c++ ncurses ncurses-devel
1.3:备注
-DCMAKE_INSTALL_PREFIX= 安装主目录
-DSYSCONFDIR= 配置文件安装位置
-DMYSQL_DATADIR= 数据目录
二:编译安装
2.1:编译初始目录
~]# mkdir -pv /data/mysql/
~]# mkdir /etc/mysql/
~]# useradd -r mysql
~]# rm -rf /etc/my.cnf
~]# rm -rf /etc/my.cnf.d
~]# mkdir -pv /var/{log,run,lib}/mysql/
2.2;编译
~]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc/mysql -DMYSQL_DATADIR=/data/mysql/data
~]# make && make install
2.3:配置文件
~]# cp /usr/local/mysql/support-files/my-default.cnf /etc/mysql/my.cnf
~]# vim /etc/mysql/my.cnf
------------------------------------------------------------------------------------------------
[mysqld]
# innodb_buffer_pool_size = 128M
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /data/mysql
port = 3306
# server_id = .....
socket = /tmp/mysql.sock
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
skip_name_resolve=on
innodb_file_per_table=on
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error=/var/log/mysql/mysql.log
pid-file=/var/run/mysql/mysql.pid
------------------------------------------------------------------------------------------------
2.4:加入系统启动
~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
~]# chkconfig --add mysqld
~]# chkconfig --list mysqld
2.5:初始化
~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/
2.6:加入环境变量
~]# echo 'export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/sbin/' > /etc/profile.d/mysql.sh
~]# source /etc/profile.d/mysql.sh
2.7:修改所属用户与组
~]# chown -R mysql:mysql /usr/local/mysql
2.8:启动 停止与重启
~]# service mysqld (start | restart | stop)
2.9:进入mysql客户端
~]# mysql
三:用户授权
3.1:授权(172.0.0.1 localhost 远程 需要分别授权)
grant all privileges on *.* to '用户名'@'允许的主机' identified by '密码' with grant option;
flush privileges;
grant all privileges on *.* to 'mysql'@'127.0.0.1' identified by '123456' with grant option;
grant all privileges on *.* to 'mysql'@'localhost' identified by '123456' with grant option;
grant all privileges on *.* to 'mysql'@'%' identified by '123456' with grant option;
flush privileges;
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;
==============================================================
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:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h iZm5e35fwy8k6ujq6d272yZ password 'new-password'
Alternatively you can run:
/usr/local/mysql/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 . ; /usr/local/mysql/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 at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/local/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
WARNING: Default config file /etc/mysql/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
========================================
一:准备
1.1:源码下载
mysql 官网:http://dev.mysql.com/downloads/mysql/
github 地址:https://github.com/mysql/mysql-server
1.2:安装依赖
~]# yum -y install perl perl-devel autoconf cmake gcc gcc-c++ ncurses ncurses-devel
1.3:备注
-DCMAKE_INSTALL_PREFIX= 安装主目录
-DSYSCONFDIR= 配置文件安装位置
-DMYSQL_DATADIR= 数据目录
二:编译安装
2.1:编译初始目录
~]# mkdir -pv /data/mysql/
~]# mkdir /etc/mysql/
~]# useradd -r mysql
~]# rm -rf /etc/my.cnf
~]# rm -rf /etc/my.cnf.d
~]# mkdir -pv /var/{log,run,lib}/mysql/
2.2;编译
~]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc/mysql -DMYSQL_DATADIR=/data/mysql/data
~]# make && make install
2.3:配置文件
~]# cp /usr/local/mysql/support-files/my-default.cnf /etc/mysql/my.cnf
~]# vim /etc/mysql/my.cnf
------------------------------------------------------------------------------------------------
[mysqld]
# innodb_buffer_pool_size = 128M
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /data/mysql
port = 3306
# server_id = .....
socket = /tmp/mysql.sock
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
skip_name_resolve=on
innodb_file_per_table=on
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error=/var/log/mysql/mysql.log
pid-file=/var/run/mysql/mysql.pid
------------------------------------------------------------------------------------------------
2.4:加入系统启动
~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
~]# chkconfig --add mysqld
~]# chkconfig --list mysqld
2.5:初始化
~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/
2.6:加入环境变量
~]# echo 'export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/sbin/' > /etc/profile.d/mysql.sh
~]# source /etc/profile.d/mysql.sh
2.7:修改所属用户与组
~]# chown -R mysql:mysql /usr/local/mysql
2.8:启动 停止与重启
~]# service mysqld (start | restart | stop)
2.9:进入mysql客户端
~]# mysql
三:用户授权
3.1:授权(172.0.0.1 localhost 远程 需要分别授权)
grant all privileges on *.* to '用户名'@'允许的主机' identified by '密码' with grant option;
flush privileges;
grant all privileges on *.* to 'mysql'@'127.0.0.1' identified by '123456' with grant option;
grant all privileges on *.* to 'mysql'@'localhost' identified by '123456' with grant option;
grant all privileges on *.* to 'mysql'@'%' identified by '123456' with grant option;
flush privileges;
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;
==============================================================
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:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h iZm5e35fwy8k6ujq6d272yZ password 'new-password'
Alternatively you can run:
/usr/local/mysql/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 . ; /usr/local/mysql/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 at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/local/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
WARNING: Default config file /etc/mysql/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
阅读全文
0 0
- mysql 编译安装
- mysql 5 编译安装
- mysql编译安装优化
- mysql编译安装
- ubuntu11 编译安装mysql
- mysql 5.1 编译安装
- mysql 编译安装
- mysql编译安装
- mysql的编译安装
- MySQL编译安装笔记
- MySQL编译安装
- Mysql 编译安装
- 编译安装mysql
- 源码编译安装mysql
- cmake编译安装mysql
- MySQL编译安装详解
- mysql 源码编译安装
- 编译安装mysql
- nginx编译安装
- 磁盘空间不足:这个更新需要花去 71.4 M 磁盘上总计 /boot 的空间的解决办法
- JavaScript语法结构
- C++相对路径和绝对路径
- Notepad++如何设置字体格式 Notepad++字体设置方法
- Mysql 编译安装
- HDU 3038 How Many Answers Are Wrong(维护节点间关系的并查集)
- C++动态内存管理
- 剑指offer——从上到下打印二叉树
- 数字货币深度解析区块链POS和POW的区别
- ARM汇编指令MRS和MSR
- OutputStream练习
- asp.net core 项目打开报错
- Scala入门到精通——第十七节 类型参数(一)