概述
mysql的安装及yum的使用
环境
虚拟机系统:Red Hat Enterprise Linux Server release 6.3(64位)
源码包:mysql-5.5.33.tar.gz下载地址:
http://downloads.mysql.com/archives/community/
cmake-2.8.10.2.tar.gz下载地址:
http://download.chinaunix.net/download.php?id=45213&ResourceID=1605
一、安装前的准备
yum的安装:
首先将RedHat6.3系统ISO文件加载到虚拟机中。
mount /dev/cdrom /media/
首先建立仓库文件名为rhelu4.repo:
vim /etc/yum.repos.d/rhelu4.repo
[Server]
name=Server
baseurl=file:///media/Server ###URL地址,也可为ftp、http等
gpgcheck=0 ###0为禁止签名检查
清除当前的缓存:
[[root@test Server]# yum clean all
Loaded plugins: aliases, changelog, downloadonly, kabi, presto, product-id, refresh-packagekit, security, subscription-manager, tmprepo, verify, versionlock
Updating certificate-based repositories.
Unable to read consumer identity
Loading support for Red Hat kernel ABI
Cleaning repos: Server
Cleaning up Everything
0 delta-package files removed, by presto
查看当前仓库有没有需要的想要的Server仓库
[root@test media]# yum repolist
Loaded plugins: aliases, changelog, downloadonly, kabi, presto, product-id, refresh-packagekit, security, subscription-manager, tmprepo, verify, versionlock
Updating certificate-based repositories.
Unable to read consumer identity
Loading support for Red Hat kernel ABI
Server | 4.0 kB 00:00 ...
Server/primary_db | 3.1 MB 00:00 ...
repo id repo name status
Server Server 3,585
repolist: 3,585
删除系统中自带的MySQL client以及server
yum -y remove mysql mysql-server
rpm -qa | grep mysql
删除系统自带配置文件
rm -rf /etc/my.cnf
安装MySQL依赖文件
yum -y install ncurses-devel bison openssl-devel gcc gcc-c++ make
二、cmake的安装
MySQL 5.5版本以后需要用cmake来安装
安装cmake:
查看yum中的cmake
yum list | grep cmake
查看cmake系统中是否已经安装
rpm qa | grep cmake
解压cmake
tar xvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
安装cmake
# ./configure ###指定路径(cmake不建议指定路径)--prefix /user/local/cmake
# make
# make install
# cmake --version
三、安装MySQL
# groupadd mysql
# useradd -M -g mysql -s /sbin/nologin mysql
# tar -xvf mysql-5.5.33.tar.gz
# cd mysql-5.5.33
#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all
-DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_READLINE=1
-DENABLED_LOCAL_INFILE=1
-DMYSQL_DATADIR=/usr/local/mysql/data
-DMYSQL_TCP_PORT=3306
-DSYSCONFDIR=/etc
-DINSTALL_MANDIR=/usr/share/man
-DWITH_SSL=system
-DWITH_EMBEDDED_SERVER=1
# make
# make install
四、MySQL的配置
# cd /usr/local/mysql
更改用户
# chown -R mysql:mysql mysql/
初始化
# ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/
配置:
# cp support-files/my-huge.cnf /etc/my.cnf
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
# service mysqld start
查看MySQL进程
# netstat -tnlp | grep mysql
#ps aux | grep mysqld
设置环境变量:
# echo export PATH=$PATH:/usr/local/mysql/bin >> /etc/profile
# source /etc/profile
查看环境变量:
root@test mysql]# echo $PATH
/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin
五、登陆MySQL
设置初始化后的MySQL密码:
# mysqladmin -uroot password 'mysql'
# mysql -uroot –pmysql
六、远程连接设置
查看可以远程的主机:
mysql> Select user,password,host from mysql.user;
+------+-------------------------------------------+-----------+
| user | password | host |
+------+-------------------------------------------+-----------+
| root | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA | localhost |
| root | | test |
| root | | 127.0.0.1 |
| root | | ::1 |
| | | localhost |
| | | test |
+------+-------------------------------------------+-----------+
6 rows in set (0.00 sec)
赋权限:
mysql> grant all on *.* to user1@'%' identified by '123';
从远程软件可以使用user1连接此数据库。
七、忘记密码
#vim /etc/my.cnf
[mysqld]
skip-grant-table
#service mysqld restart
#mysql
mysql>update mysql.user set password=password("123") where user="root" and host="localhost";
mysql>flush privileges;
最后
以上就是碧蓝大炮为你收集整理的yum源码mysql区别_MySQL 源码安装及yum的使用的全部内容,希望文章能够帮你解决yum源码mysql区别_MySQL 源码安装及yum的使用所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复