《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學院為您提供精彩教程。