首页 > 代码库 > LINUX Mysql5.6.19 安装

LINUX Mysql5.6.19 安装

1、需要扩展安装

yum -y install make  bison gcc-c++ cmake ncurses ncurses-devel

2、下载Mysql5.6.19

wget ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/mysql-5.6.19.tar.gz

3、解压安装

tar zxvf mysql-5.6.19.tar.gzcd mysql-5.6.19cmake -DCMAKE_INSTALL_PREFIX=/mysql/3306 -DMYSQL_DATADIR=/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1  -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

4、编译

make && make install

5、安装配置

cd /mysql/3306chown -R mysql:mysql .cd /opt/mysql-5.6.19cp support-files/my-default.cnf /etc/my.cnfcp support-files/mysql.server /etc/init.d/mysqldchmod 755 /etc/init.d/mysqldmkdir -p /mysql/datachown -R mysql:mysql /mysql/data/mysql/3306/scripts/mysql_install_db --user=mysql --basedir=/mysql/3306/ --datadir=/mysql/data/

6、启动

service mysqld start

7、测试

[root@mysql mysql-5.6.19]# /mysql/3306/bin/mysql -u root -pEnter password:Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.19 Source distribution Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners. Type help; or \h for help. Type \c to clear the current input statement. mysql>

8、停止MYSQL

service mysqld stop

9、以安全模式启动MYSQL

/mysql/3306/bin/mysqld_safe --skip-grant-tables & 

10、安全模式进入数据库

/mysql/3306/bin/mysql -u root -p

11、修改密码

>use mysql>update user set password=password("新密码") where user="root";>flush privileges;

12、退出,重启