【MySQL】RHEL6.5下MySQ编译安装、简单的MySQL操作
软件下载:
MySQL-5.5.40.tar.gz:http://down.51cto.com/data/1966628
cmake-2.8.0(MySQL编译工具):http://down.51cto.com/data/1966627
配置防火墙,开启3306端口、selinux
安装编译工具
[code=bash;toolbar:false">[root@localhost src]# yum install -y gcc gcc-c++[root@localhost cmake-2.8.0]# cd ..
[root@localhost src]# tar zxvf mysql-5.5.40.tar.gz
[root@localhost src]# groupadd mysql
[root@localhost src]# useradd -g mysql mysql -s /sbin/nologin
[root@localhost src]# mkdir -p /data/mysql
[root@localhost src]# chown -R mysql:mysql /data/mysql
[root@localhost src]# cd mysql-5.5.40
[root@localhost mysql-5.5.40]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc
.....
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:83 (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.
[root@localhost mysql-5.5.40]# rm CMakeCache.txt
rm: remove regular file `CMakeCache.txt'? y
[root@localhost mysql-5.5.40]# yum -y install ncurses-devel
[root@localhost mysql-5.5.40]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc
......
Warning: Bison executable not found in PATH
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/mysql-5.5.40
[root@localhost mysql-5.5.40]# yum -y install Bison
[root@localhost mysql-5.5.40]# make && make install
[root@localhost mysql-5.5.40]# rm -rf /etc/my.cnf #删除系统默认的配置文件(如果默认没有就不用删除)
[root@localhost mysql-5.5.40]# cd /usr/local/mysql/
[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql #生成mysql系统数据库
[root@localhost mysql]# ln -s /usr/local/mysql/my.cnf /etc/my.cnf
[root@localhost mysql]# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #把Mysql加入系统启动
[root@localhost mysql]# chmod 755 /etc/init.d/mysqld
[root@localhost mysql]# chkconfig mysqld on
[root@localhost mysql]# vim /etc/rc.d/init.d/mysqld
46 basedir=/usr/local/mysql
47 datadir=/data/mysql
[root@localhost mysql]# vim /etc/profile #把mysql服务加入系统环境变量:在最后添加下面这一行
export PATH=$PATH:/usr/local/mysql/bin
[root@localhost mysql]# source /etc/profile[p][root@localhost ~]# yum -y install mysql mysql-server mysql-devel[p][root@localhost ~]# mysqladmin -u root password 'justin'
[root@localhost ~]# mysql -u root -p password 'justin'[p][root@localhost ~]# mysql -uroot -p #登陆数据库
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> show databases; #查询当前所有的库
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| zabbix |
+--------------------+
4 rows in set (0.02 sec)
mysql> use zabbix; #进入zabbix数据库
Database changed
mysql> show tables; #再查看一下里面有很多张表,admin密码放在users表里面。
+-----------------------+
| Tables_in_zabbix |
+-----------------------+
| acknowledges |
| actions |
| alerts |
| application_template |
| applications |
| auditlog |
| auditlog_details |
| autoreg_host |
| conditions |
| config |
| dbversion |
| dchecks |
| dhosts |
| drules |
| dservices |
| escalations |
| events |
| expressions |
| functions |
| globalmacro |
| globalvars |
| graph_discovery |
| graph_theme |
| graphs |
| graphs_items |
| group_discovery |
| group_prototype |
| groups |
| history |
| history_log |
| history_str |
| history_str_sync |
| history_sync |
| history_text |
| history_uint |
| history_uint_sync |
| host_discovery |
| host_inventory |
| hostmacro |
| hosts |
| hosts_groups |
| hosts_templates |
| housekeeper |
| httpstep |
| httpstepitem |
| httptest |
| httptestitem |
| icon_map |
| icon_mapping |
| ids |
| images |
| interface |
| interface_discovery |
| item_discovery |
| items |
| items_applications |
| maintenances |
| maintenances_groups |
| maintenances_hosts |
| maintenances_windows |
| mappings |
| media |
| media_type |
| node_cksum |
| nodes |
| opcommand |
| opcommand_grp |
| opcommand_hst |
| opconditions |
| operations |
| opgroup |
| opmessage |
| opmessage_grp |
| opmessage_usr |
| optemplate |
| profiles |
| proxy_autoreg_host |
| proxy_dhistory |
| proxy_history |
| regexps |
| rights |
| screens |
| screens_items |
| scripts |
| service_alarms |
| services |
| services_links |
| services_times |
| sessions |
| slides |
| slideshows |
| sysmap_element_url |
| sysmap_url |
| sysmaps |
| sysmaps_elements |
| sysmaps_link_triggers |
| sysmaps_links |
| timeperiods |
| trends |
| trends_uint |
| trigger_depends |
| trigger_discovery |
| triggers |
| user_history |
| users | #users表
| users_groups |
| usrgrp |
| valuemaps |
+-----------------------+
108 rows in set (0.00 sec)
mysql> select * from users; # 查看表里的字段,admin对应的ID是1
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
| userid | alias | name | surname | passwd | url | autologin | autologout | lang | refresh | type | theme | attempt_failed | attempt_ip | attempt_clock | rows_per_page |
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
| 1 | Admin | Zabbix | Administrator | 5fce1b3e34b520afeffb37ce08c7cd66 | | 1 | 0 | zh_CN | 30 | 3 | default | 0 | | 0 | 50 |
| 2 | guest | | | d41d8cd98f00b204e9800998ecf8427e | | 0 | 900 | en_GB | 30 | 1 | default | 0 | | 0 | 50 |
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
2 rows in set (0.00 sec)
mysql> select userid,passwd from users;
+--------+----------------------------------+
| userid | passwd |
+--------+----------------------------------+
| 1 | 5fce1b3e34b520afeffb37ce08c7cd66 | #密码是加密的
| 2 | d41d8cd98f00b204e9800998ecf8427e |
+--------+----------------------------------+
2 rows in set (0.00 sec)
mysql>[p]mysql> update users set passwd='e2798af12a7a0f4f70b4d69efbc25f4d' where userid = '1';
#或者直接使用update users set passwd=md5("redhat") where userid='1';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
[root@localhost ~]#[p]
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| otrs |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> drop database otrs;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql>[p]
- 【MySQL】RHEL6.5下MySQ编译安装、简单的MySQL操作
- mysql5.5.28.tar.gz编译安装操作笔记
- 在RHEL5 源码编译安装MySQL 5.5.23
- Linux CentOS6.5下编译安装MySQL 5.6.16
- mysql5.5.28.tar.gz编译安装操作笔记
- Ubuntu 安装mysql和简单操作
- 最新Mysql-5.1.35在RHEL5.3(CentOS5.3)编译安装步骤
- CentOS-6.5下编译安装LNMP环境【nginx1.8.1、mysql5.5.43、php 5.6】
- mysql5.5.28.tar.gz编译安装操作笔记
- Linux CentOS6.5下编译安装MySQL 5.6.22
- Ubuntu 安装mysql和简单操作
- ubuntu安装mysql可视化工具MySQL-workbench及简单操作
- Ubuntu 安装mysql和简单操作
- Ubuntu 安装mysql和简单操作
- Ubuntu下mysql的安装以及简单的命令操作
- Linux CentOS6.5下编译安装MySQL 5.6.16【给力详细教程】
- Linux-6.5下 基于cmake28来编译安装mysql服务配置解析
- Ubuntu 安装mysql和简单操作
- Ubuntu 安装mysql和简单操作
- 在RHEL 5.4上编译安装MySQL 5.1.54并使之支持SphinxSE