mysql-5.5 for linux源码安装
mysql-5.5 for linux源码安装
1.使用Yum安装依赖软件包
# yum install -y gcc gcc-c++ gcc-g77 autoconf automake bison zlib* fiex* \
libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
2.安装cmake
# yum install -y cmake
3.解压缩并编译安装MySQL源码包
# tar xzvf mysql-5.5.27.tar.gz
# mv mysql-5.5.27 mysql
# cd mysql
#配置编译(参考:http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html)
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DSYSCONFDIR=/usrl/local/mysql/etc \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_USER=mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1
# make
# make install
注意事项:
重新编译时,需要清除旧的对象文件和缓存信息。
# make clean
# rm -f CMakeCache.txt
4.添加mysql用户及用户组并修改目录所有权限
[root@ttt mysql]# groupadd mysql
[root@ttt mysql]# useradd -r -g mysql mysql
[root@ttt mysql]# chown -R mysql /usr/local/mysql
[root@ttt mysql]# chgrp -R mysql /usr/local/mysql
5.安装基础数据库并复制示例配置文件
# cd /usr/local/mysql
# chmod +x scripts/*
[root@ttt mysql]# ./scripts/mysql_install_db --basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data --user=mysql
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
[root@ttt ~]# export PATH=$PATH:/usr/local/mysql/bin //全局宣告mysql命令的路径
[root@ttt ~]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile //写入开机启动文件
6.注册mysql系统服务并启动mysql
[root@ttt mysql]# chmod 755 support-files/mysql.server
[root@ttt mysql]# ls -l support-files/mysql.server
-rwxr-xr-x 1 mysql mysql 10650 6月 22 19:21 support-files/mysql.server
[root@ttt mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@ttt mysql]# chown root.root /etc/init.d/mysql
[root@ttt mysql]# chkconfig --add mysql
[root@ttt mysql]# chkconfig --level 35 mysql on
[root@ttt mysql]# chkconfig --list mysql
mysql 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@ttt mysql]# service mysql start
Starting MySQL... [确定]
[root@ttt mysql]# netstat -ltu |grep mysql
tcp 0 0 *:mysql *:* LISTEN
[root@ttt mysql]# ps -ef | grep mysql
root 15492 1 0 21:00 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe
--datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/ttt.pid
mysql 15744 15492 0 21:00 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --
basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-
dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/ttt.err
--pid-file=/usr/local/mysql/data/ttt.pid --socket=/tmp/mysql.sock --port=3306
root 15896 1098 0 21:10 pts/0 00:00:00 grep mysql
7.安装完成,启动mysql数据库,进入测试
[root@ttt ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.27-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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use mysql
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
24 rows in set (0.00 sec)
mysql>
8.修改mysql数据库root用户密码并登录验证
[root@ttt ~]# mysqladmin -u root password 'mysqlpass' --给“root”用户设置一个密码
[root@ttt ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.27-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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql>
mysql-5.5 for linux源码安装的更多相关文章
- Linux源码安装JDK1.8
Linux源码安装Java 1.到官网下载 jdk-8u131-linux-x64.tar.gz 官网地址:http://www.oracle.com/technetwork/java/javase/ ...
- linux源码安装mysql,shell编程学习,ubuntu
一.mysql安装 以源码安装的方式编译和安装Mysql 5.6. 1.卸载旧版本 rpm -qa | grep mysql 检查是否有旧版本 查询结果:mysql-libs-5.1.73-7.el6 ...
- Linux源码安装mysql步骤
创建文件夹: mkdir /usr/local/webserver 安装必要依赖包 yum -y install gcc gcc-c++ make ncurses-devel安装cmake ...
- Linux源码安装软件
Linux环境下 源码编译安装软件 ==== 1. 下载,步骤略 ==== 2. 验证,部分官方下载同时提供签名,MD5,sha1,sha256等校验信息. $ gpg --verify gnupg- ...
- Linux 源码安装 FFmpeg
加班次数频繁,已经快一年没有写博了.由于此次在项目中使用到了 FFmpeg 来处理音视频,顾记录下在 Linux 系统中源码安装 FFmpeg 以便不时之需. 1. 安装 yasm yasm 是一个汇 ...
- linux源码安装软件的一般方法
rhel系统貌似安装不了xmgrace,配置的时候居然说要那个M*tif库.百度了一下,需要openmotif库,然后用root账户想要用yum安装一下这个库,搞了好久没搞懂.后面搞明白了,原因竟是因 ...
- Linux 源码安装Ansible 参考篇
Ansible 源码搭建配置 近期在学习自动化运维相关技术,文章主要模拟内网情况下对Ansible的安装演示,源码安装较为繁琐.枯燥,尤其是在实际安装过程中可能出现各式各样的问题,所有在安装过程中尽量 ...
- Linux源码安装RabbitMQ高可用集群
1.环境说明 linux版本:CentOS Linux release 7.9.2009 erlang版本:erlang-24.0 rabbitmq版本:rabbitmq_server-3.9.13 ...
- Linux 源码安装apache 与常见错误解决
文档原位置 一.编译安装apache 1.解决依赖关系 httpd-2.4.4需要较新版本的apr和apr-util,因此需要事先对其进行升级. 升级方式有两种,一种是通过源代码编译安装,一种是直接升 ...
随机推荐
- lua_string_pattern
两大特点: 1. string库中所有的字符索引从前往后是1,2,...;从后往前是-1,-2,... 2. string库中所有的function都不会直接操作字符串,而是返回一个新的字符串. 库函 ...
- Android RecyclerView遇到notifyDataSetChanged无效时的解决方案
一.简述 不管AbsListView(ListView.GridView)或是新出的RecyclerView,在使用notifyDataSetChanged方法更新列表数据时,一定要保证数据为同个对象 ...
- C#入门经典 Chapter5 变量的更多内容
5.1类型转换 1.类型转换 1.1隐式转换:所有情况下可进行,编译器执行转换. 1.2显示转换 强制转换:强迫数据从一种类型转换为另一种类型. (<destinationType>)&l ...
- JS——正则案例
验证座机号码 <!DOCTYPE html> <html> <head lang="en"> <meta charset="UT ...
- asp.net MVC 下拉多级联动及编辑
多级联动实现,附源码.当前,部分代码是参与博客园其它网友. 新增,前台代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 ...
- Oracle Sequence不设置cache参数的几个潜在问题(转载)
转载于 http://www.uml.org.cn/sjjm/201204065.asp 在Oracle中,我们没有MYSQL和SQL Server ...
- HDU_1532_最大流
Drainage Ditches Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- 生成元(Digit Generator, ACM/ICPC Seoul 2005, UVa1583)
如果x加上x的各个数字之和得到y,就说x是y的生成元.给出n(1≤n≤100000),求最小 生成元.无解输出0.例如,n=216,121,2005时的解分别为198,0,1979. [分析] 本题看 ...
- vim使用配置-python
安装vundle git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim 添加配置文件 vim ~/.v ...
- [luogu3155 CQOI2009] 叶子的染色(树形dp)
传送门 Solution 十分简单的树形dpQwQ,转移关系:父亲染了儿子不用染 只需要确定根就是简单树形dp,而其实根可以随便取一个非叶子节点 可以分情况讨论发现答案并不会改变 Code //By ...