Ubuntu 13.04中源码方式安装MySQL 5.5.33
转载:http://lssrc.com/archives/385
环境:Ubuntu 13.04
数据库:MySQL 5.5.33
1.下载MySQL 5.5.33源码,地址http://dev.mysql.com/downloads/mysql/5.5.html#downloads
2.删除已安装过的MySQL
- carl@Carl-U:~$ sudo apt-get remove mysql*
3.添加用户组和用户
- carl@Carl-U:~$ sudo groupadd mysql
- carl@Carl-U:~$ sudo useradd -r -g mysql mysql
4.创建MySQL的安装目录
- carl@Carl-U:~$ sudo mkdir /usr/local/mysql
5.修改MySQL安装目录所有者
- carl@Carl-U:~$ sudo chown mysql:mysql /usr/local/mysql/
6.解压源码包
- carl@Carl-U:~$ sudo tar -zxvf mysql-5.5.33.tar.gz
7.进入 mysql-5.5.33目录内,因为在新版本的MySQL源码包中没有了configure,改用cmake方式编译。如果没有安装,先安装cmake
- carl@Carl-U:~$ sudo apt-get install cmake
- carl@Carl-U:~$ sudo apt-get install libncurses5-dev
注:ubuntu下安装libncurses5-dev;redhat下安装ncurses-devel
还需要其他程序
- carl@Carl-U:~$ sudo apt-get install g++
- carl@Carl-U:~$ sudo apt-get install bison
- carl@Carl-U:~$ sudo apt-get install libaio1
8.编译
- carl@Carl-U:~$ sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
- -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock
- -DDEFAULT_CHARSET=utf8
- -DDEFAULT_COLLATION=utf8_general_ci
- -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk
- -DWITH_MYISAM_STORAGE_ENGINE=1
- -DWITH_INNOBASE_STORAGE_ENGINE=1
- -DWITH_MEMORY_STORAGE_ENGINE=1
- -DWITH_READLINE=1
- -DENABLED_LOCAL_INFILE=1
- -DMYSQL_DATADIR=/usr/local/mysql/data
- -DMYSQL_USER=mysql
- -DMYSQL_TCP_PORT=3306
编译结束后,出现下面的警告,不妨碍执行make
- ……
- – Generating done
- CMake Warning:
- Manually-specified variables were not used by the project:
- MYSQL_USER
- WITH_MEMORY_STORAGE_ENGINE
- – Build files have been written to: /home/carl/mysql-5.5.33
9.执行make和make install
- carl@Carl-U:~/mysql-5.5.33$ sudo make
- – Running cmake version 2.8.10.1
- – Looking for SHM_HUGETLB
- – Looking for SHM_HUGETLB - found
- – MySQL 5.5.33
- – Looking for sys/types.h
- – Looking for sys/types.h - found
- – Looking for stdint.h
- ……
- carl@Carl-U:~/mysql-5.5.33$ sudo make install
- [ 0%] Built target INFO_BIN
- [ 0%] Built target INFO_SRC
- [ 0%] Built target abi_check
- [ 2%] Built target zlib
- ……
10.从源码目录拷贝一些配置文件
- carl@Carl-U:~$ cd /home/carl/mysql-5.5.33/support-files/
- carl@Carl-U:~/mysql-5.5.33/support-files$ sudo cp my-medium.cnf /etc/my.cnf
- carl@Carl-U:~/mysql-5.5.33/support-files$ sudo cp mysql.server /etc/init.d/mysql
还要给/etc/init.d/mysql一个可执行的权限
- carl@Carl-U:~/mysql-5.5.33/support-files$ sudo chmod +x /etc/init.d/mysql
修改一下这个文件
- carl@Carl-U:~/mysql-5.5.33/support-files$ sudo vi /etc/init.d/mysql
- //修改内容
- basedir=/usr/local/mysql/
- datadir=/usr/local/mysql/data/
11.初始化数据库
进入MySQL安装后的目录
- carl@Carl-U:~/mysql-5.5.33$ cd /usr/local/mysql/
- carl@Carl-U:/usr/local/mysql$ sudo scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql/ –datadir=/usr/local/mysql/data
出现以下提示
- 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:
- /usr/local/mysql//bin/mysqladmin -u root password ’new-password’
- /usr/local/mysql//bin/mysqladmin -u root -h Carl-U 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/ ; /usr/local/mysql//bin/mysqld_safe &
- You can test the MySQL daemon with mysql-test-run.pl
- cd /usr/local/mysql//mysql-test ; perl mysql-test-run.pl
- Please report any problems with the /usr/local/mysql//scripts/mysqlbug script!
12.启动MySQL服务
- carl@Carl-U:/usr/local/mysql$ sudo /etc/init.d/mysql start
- Starting MySQL
- ….. *
13.修改数据库root用户的密码
- carl@Carl-U:~$ sudo /usr/local/mysql/bin/mysqladmin -u root password ’root’
13.登录
这时候直接输入mysql是找不到的
需要使用/usr/local/mysql/bin/mysql
- carl@Carl-U:~$ sudo /usr/local/mysql/bin/mysql -u root -p
- Enter password:
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 2
- Server version: 5.5.33-log Source distribution
- Copyright (c) 2000, 2013, 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>
查看有哪些数据库
- mysql> show databases;
- +———————-+
- | Database |
- +———————-+
- | information_schema |
- | mysql |
- | performance_schema |
- | test |
- +———————-+
- 4 rows in set (0.00 sec)
查看有哪些mysql用户
- mysql> use mysql;
- mysql> select user,host,password from user;
- +——+————+——————————————-+
- | user | host | password |
- +——+————+——————————————-+
- | root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
- | root | Carl-U | |
- | root | 127.0.0.1 | |
- | root | ::1 | |
- | | localhost | |
- | | Carl-U | |
- +——+————+——————————————-+
- 6 rows in set (0.00 sec)
删除密码为空的用户
- mysql> delete from user where password=”;
- Query OK, 5 rows affected (0.00 sec)
14.创建一个可以远程链接的用户
- mysql> grant all privileges on *.* to root@’%' identified by ’root’ with grant option;
- mysql> flush privileges;
15.创建一个链接
- carl@Carl-U:~$ sudo ln -s /usr/local/mysql/bin/mysql /usr/bin/
这时候使用mysql不会提示找不到了
- carl@Carl-U:~$ mysql -u root -p
- Enter password:
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 10
- Server version: 5.5.33-log Source distribution
- Copyright (c) 2000, 2013, 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>
16.安装过程中有问题请了留言。
Ubuntu 13.04中源码方式安装MySQL 5.5.33相关推荐
- linux上源码安装mysql,Linux中源码包安装MySQL的shell脚本
#!/bin/bash #安装MYSQL yum -y install ncurses-devel yum -y install autoconf tar zxf /cmake--C / cd /cm ...
- ubuntu 16.04 Nginx源码部署安装
nginx安装 1.安装zlib依赖库:sudo apt-get install zlib1g-dev 2.进入解压相关文件: tar –xzvf openssl-1.0.1.tar.gz tar – ...
- php源码无法安装mysql_linux中源码编译安装mysql常见错误
(一) #./configure --prefix=/usr/local/mysql-5.1.54 (mysql指定路径安装报错:) 如下: checking for termcap function ...
- linux中源码编译安装mysql常见错误
一) #./configure --prefix=/usr/local/mysql-5.1.54 (mysql指定路径安装报错:) 如下: checking for termcap functions ...
- 如何以源码安装mysql_CentOS以源码方式安装MySQL
系统环境 CentOS 6.5 64位 MySQL 5.6.23 安装基础组件 yum -y install cmake ncurses-devel 创建用户和组 groupadd mysql use ...
- ubuntu安装python_ubuntu18.04下源码编译安装最新版本Python3
原文链接:ubuntu18.04下源码编译安装最新版本Python3 截止到2019年4月9日,Python3最新的版本是3.7.3. 在ubuntu18.04中已经安装的Python3版本是3.6. ...
- VMware Workstation 8下Ubuntu 13.04中安装VMware Tools出错
vm 8.0上安装ubuntu 13.04系统以后,需要安装一个vm tool 方便屏幕适应和文件拷贝,但是发现由于ubuntu 13.04 使用的内核太新了,而vm8.0 不能够提供这样的文件,导致 ...
- python版本升级后编译_ubuntu18.04下源码编译安装最新版本Python3
截止到2019年4月9日,Python3最新的版本是3.7.3. 在ubuntu18.04中已经安装的Python3版本是3.6.7,下面我们就演示一下如何在ubuntu18.04下源码编译安装Pyt ...
- 源码方式安装的nginx注册到systemctl管理
用源码方式安装的nginx每次都要进入安装目录才能进行启动.重启.停止操作,使用yum install nginx方式安装的话会自动注册到systemctl管理中,源码方式安装的nginx注册到sys ...
最新文章
- Web服务器性能/压力测试工具http_load、webbench、ab、Siege使用教程
- arcgis 散瓦片发布服务_利用已有的缓存地图文件发布ArcGIS Server瓦片服务
- C#教程之自己动手写映射第四节[封装删除]
- UCOS 操作系统 安装配置环境
- 【解惑】这么多技术我该怎么学
- Java向后不兼容历史的观察
- oracle 创交表,创建交叉报表(oracle)_oracle
- 【HDU - 1281 】棋盘游戏 (经典的二分图匹配,匈牙利算法,枚举删除顶点,必须边,关建边)
- 详解淘宝直播背后的技术!
- 解决Access to Message Queuing system is denied.权限问题
- 电力系统谐波分析代码
- c#+上传文件至服务器,C# 实现文件上传到服务器
- 迄今见过的最好的职业规划文章
- [CF1421E]Swedish Heroes
- 项目经理面试题及答案
- 人人都是产品经理 产品经理培训 互联网产品经理
- myEclipse 注册码 在线生成
- docker+阿里云镜像服务
- win7修改计算机主机名称,Windows7旗舰版计算机名称无法修改解决方法
- 专业工具软件课程意见汇总及答复
热门文章
- 论文阅读:BEVSegFormer: Bird’s Eye View Semantic Segmentation FromArbitrary Camera Rigs
- Amazon Simple Storage Service (Amazon S3) 简介
- SaaSBase:什么是Oracle Fusion ERP?
- [Git] Git整理(一) Git的安装、配置和基本操作
- 必备技能13:如何白嫖Scribd上的pdf文件
- Lyx使用IEEE模板编写latex论文
- 客流管控系统可以协助博物馆进行人数管理
- 趣头条自媒体怎么赚钱,趣头条真的能赚钱吗
- PS使用技巧方法与技巧记录
- HashMap、HashTable的key和value是否可为null