CentOS 6.6安装MySQL 5.6
时间:2015-03-05 17:27 来源:linux.it.net.cn 作者:IT
源码安装
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下载:http://download.csdn.net/download/wormsnake/5116910
[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;
2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。
Sql代码 复制代码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;
(责任编辑:IT)
源码安装 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下载:http://download.csdn.net/download/wormsnake/5116910 [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; 2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。 Sql代码 复制代码 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; FLUSH PRIVILEGES; (责任编辑:IT) |