发布于 2015-12-10 01:28:52 | 138 次阅读 | 评论: 0 | 来源: PHPERZ

这里有新鲜出炉的Mysql教程,程序狗速度看过来!

Mysql关系型数据库管理系统

MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQL AB公司。MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL作为网站数据库。


源码安装
yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib fiex libxml ncurses-devel libmcrypt libtool-ltdl-devel* make cmake
编译安装

[root@server182 ~]# groupadd mysql

[root@server182 ~]# useradd -r -g mysql mysql

下载mysql-5.6.10.tar.gz

[root@server182 ~]# tar -zxvf mysql-5.6.10.tar.gz

[root@server182 ~]# cd mysql-5.6.10

[root@server182 mysql-5.6.10]# cmake .

[root@server182 mysql-5.6.10]# make && make install

-------------------------默认情况下是安装在/usr/local/mysql

[root@server182 ~]# chown -R mysql.mysql /usr/local/mysql

[root@server182 ~]# cd /usr/local/mysql/scripts

[root@server182 ~]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

[root@server182 ~]# cd /usr/local/mysql/support-files

[root@server182 support-files]# cp mysql.server /etc/rc.d/init.d/mysql

[root@server182 support-files]# cp my-default.cnf /etc/my.cnf

[root@server182 ~]# chkconfig -add mysql

[root@server182 ~]# chkconfig mysql on

[root@server182 ~]# service mysql start

Starting MySQL SUCCESS!

修改密码
mysqladmin -u root password '123456'
登陆
mysql -u root -p

修改远程访问权限

1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"

Sql代码 复制代码

    1. mysql -u root -pvmwaremysql>use mysql;

    2. mysql>update user set host = '%' where user = 'root';

    3. mysql>select host, user from user;

  1. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

Sql代码 复制代码
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务