《Mysql学习RHEL6.2编译安装MySQL 5.6.16过程分享》要点:
本文介绍了Mysql学习RHEL6.2编译安装MySQL 5.6.16过程分享,希望对您有用。如果有疑问,可以联系我们。
一、环境说明:MYSQL入门
二、准备工作与系统配置MYSQL入门
1.下载安装包MYSQL入门
这里下载的是较新的MySQL 5.6.16版本,更新迭代的太快了,文件为:mysql-5.6.16.tar.gzMYSQL入门
下载地址:http://dev.mysql.com/downloads/mysql/MYSQL入门
2. 安装编译必须的包MYSQL入门
个人经验上面两个包是比较容易缺失,像gcc,make,cmake则是必备的了,也建议检查一下:MYSQL入门
3.创建MySQL用户和组MYSQL入门
4.配置环境变量MYSQL入门
在.bash_profile文件中为PATH变量追加mysql路径:
MYSQL入门
三、安装MySQLMYSQL入门
解压安装包:MYSQL入门
编译脚本如下:MYSQL入门
make && make install
MYSQL入门
基本上安装的选项还是一目了然的,更多的选项示意参见:MYSQL入门
http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.htmlMYSQL入门
编译时间是机器而定,我的有20多分钟的样子.MYSQL入门
安装完成后要给根目录指定为mysql用户和组,也可以在这时候进行mysql用户和组的创建工作:
MYSQL入门
安装完成的MySQL根目录如下:
MYSQL入门
可以看到已经创建一个默认的配置文件my.cnf.MYSQL入门
四、MySQL初始化MYSQL入门
执行初始化脚本来创建数据库:
MYSQL入门
创建MySQL服务并启动:
MYSQL入门
接下来就是配置数据库了,在新版的MySQL安装过程中提供了一个脚本用于自动完成数据库使用前的配置工作,这个脚本位于/usr/local/mysql/bin/mysql_secure_installation,它会完成以下任务:MYSQL入门
1.指定root用户密码(默认是没有密码的)
2.删除匿名用户
3.设置root用户的远程访问(对应的要在防火墙中开启3306端口)
4.是否删除测试数据库
5.重载权限表MYSQL入门
这里建议使用这个脚本,执行过程如下:MYSQL入门
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!MYSQL入门
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.MYSQL入门
Enter current password for root (enter for none):
OK, successfully used password, moving on...MYSQL入门
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.MYSQL入门
You already have a root password set, so you can safely answer 'n'.MYSQL入门
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!MYSQL入门
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.MYSQL入门
Remove anonymous users? [Y/n] Y
... Success!MYSQL入门
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.MYSQL入门
Disallow root login remotely? [Y/n] n
... skipping.MYSQL入门
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.MYSQL入门
Remove test database and access to it? [Y/n] n
... skipping.MYSQL入门
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.MYSQL入门
Reload privilege tables now? [Y/n] Y
... Success!MYSQL入门
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.MYSQL入门
Thanks for using MySQL!MYSQL入门
Cleaning up...
MYSQL入门
当然也可以手动完成这些操作:MYSQL入门
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.MYSQL入门
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.MYSQL入门
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MYSQL入门
mysql> delete from mysql.user where user='';
Query OK, 2 rows affected (0.01 sec)MYSQL入门
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypasswd' WITH GRANT OPTION;
Query OK, 0 rows affected (0.01 sec)MYSQL入门
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MYSQL入门
《Mysql学习RHEL6.2编译安装MySQL 5.6.16过程分享》是否对您有启发,欢迎查看更多与《Mysql学习RHEL6.2编译安装MySQL 5.6.16过程分享》相关教程,学精学透。维易PHP学院为您提供精彩教程。