Linux下安裝mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
從官網(wǎng)下載mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
創(chuàng)建mysql用戶
[root@Master home]# useradd mysql [root@Master data]# echo 'mysql'|passwd --stdin mysql
更改用戶 mysql 的密碼 。
passwd: 所有的身份驗證令牌已經(jīng)成功更新。
創(chuàng)建mysql用戶的原因
不用mysql用戶會出現(xiàn)一下錯誤,嘗試了很多次,添加mysql用戶安裝成功
*當(dāng)然很多時候我們已經(jīng)創(chuàng)建好別的用戶,來完成日常的操作如果不創(chuàng)建mysql用戶,修改mysql/bin目錄下的mysqld_safe文件; //親測成功
具體步驟:
[root@Master bin]# vim mysqld_safe user='mysql' 修改為 user='hadoop' //自己的用戶 后邊步驟基本相同* [root@Slave1 data]# service mysql start Starting MySQL...... ERROR! The server quit without updating PID file (/home/hadoop/ruanJian/mysql/data/Slave1.Hadoop.pid). [root@Master data]#vim Slave1.Hadoop.err //查看日志文件 160830 15:56:44 mysqld_safe Starting mysqld daemon with databases from /home/hadoop/ruanJian/mysql/data 2016-08-30 15:56:49 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-08-30 15:56:49 1990 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists! 2016-08-30 15:56:49 1990 [ERROR] Aborting 2016-08-30 15:56:49 1990 [Note] Binlog end 2016-08-30 15:56:49 1990 [Note] /home/hadoop/ruanJian/mysql/bin/mysqld: Shutdown complete 160830 15:56:49 mysqld_safe mysqld from pid file /home/hadoop/ruanJian/mysql/data/Slave1.Hadoop.pid ended
在mysql用戶下創(chuàng)建data目錄并解壓
[root@Master data]# tar -zxvf mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz [root@Master data]# mv mysql-5.6.12-linux-glibc2.5-x86_64 mysql //重命名
設(shè)置權(quán)限
[root@Master data]# chown -R mysql:mysql mysql
切換用戶并進入mysql/scripts 目錄
[root@Master data]# su mysql [mysql@Master data]$ cd mysql/scripts/ [mysql@Master scripts]$
安裝(目錄根據(jù)自己的mysql解壓目錄自行設(shè)置)
[mysql@Master scripts]$ ./mysql_install_db --user=mysql --basedir=/home/mysql/data/mysql --datadir=/home/mysql/data/mysql/data
輸出信息
Installing MySQL system tables...2016-08-30 19:55:41 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-08-30 19:55:42 1354 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000) 2016-08-30 19:55:42 1354 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000) 2016-08-30 19:55:42 1354 [Note] InnoDB: The InnoDB memory heap is disabled 2016-08-30 19:55:42 1354 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2016-08-30 19:55:42 1354 [Note] InnoDB: Compressed tables use zlib 1.2.3 2016-08-30 19:55:42 1354 [Note] InnoDB: Using Linux native AIO 2016-08-30 19:55:42 1354 [Note] InnoDB: Not using CPU crc32 instructions 2016-08-30 19:55:42 1354 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2016-08-30 19:55:42 1354 [Note] InnoDB: Completed initialization of buffer pool 2016-08-30 19:55:42 1354 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2016-08-30 19:55:42 1354 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2016-08-30 19:55:42 1354 [Note] InnoDB: Database physically writes the file full: wait... 2016-08-30 19:55:42 1354 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2016-08-30 19:55:43 1354 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2016-08-30 19:55:44 1354 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2016-08-30 19:55:44 1354 [Warning] InnoDB: New log files created, LSN=45781 2016-08-30 19:55:44 1354 [Note] InnoDB: Doublewrite buffer not found: creating new 2016-08-30 19:55:44 1354 [Note] InnoDB: Doublewrite buffer created 2016-08-30 19:55:44 1354 [Note] InnoDB: 128 rollback segment(s) are active. 2016-08-30 19:55:44 1354 [Warning] InnoDB: Creating foreign key constraint system tables. 2016-08-30 19:55:44 1354 [Note] InnoDB: Foreign key constraint system tables created 2016-08-30 19:55:44 1354 [Note] InnoDB: Creating tablespace and datafile system tables. 2016-08-30 19:55:44 1354 [Note] InnoDB: Tablespace and datafile system tables created. 2016-08-30 19:55:44 1354 [Note] InnoDB: Waiting for purge to start 2016-08-30 19:55:44 1354 [Note] InnoDB: 5.6.12 started; log sequence number 0 2016-08-30 19:55:44 1354 [Note] Binlog end 2016-08-30 19:55:44 1354 [Note] InnoDB: FTS optimize thread exiting. 2016-08-30 19:55:44 1354 [Note] InnoDB: Starting shutdown... 2016-08-30 19:55:46 1354 [Note] InnoDB: Shutdown completed; log sequence number 1625977 OK Filling help tables...2016-08-30 19:55:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-08-30 19:55:46 1377 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000) 2016-08-30 19:55:46 1377 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000) 2016-08-30 19:55:46 1377 [Note] InnoDB: The InnoDB memory heap is disabled 2016-08-30 19:55:46 1377 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2016-08-30 19:55:46 1377 [Note] InnoDB: Compressed tables use zlib 1.2.3 2016-08-30 19:55:46 1377 [Note] InnoDB: Using Linux native AIO 2016-08-30 19:55:46 1377 [Note] InnoDB: Not using CPU crc32 instructions 2016-08-30 19:55:46 1377 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2016-08-30 19:55:46 1377 [Note] InnoDB: Completed initialization of buffer pool 2016-08-30 19:55:46 1377 [Note] InnoDB: Highest supported file format is Barracuda. 2016-08-30 19:55:46 1377 [Note] InnoDB: 128 rollback segment(s) are active. 2016-08-30 19:55:46 1377 [Note] InnoDB: Waiting for purge to start 2016-08-30 19:55:46 1377 [Note] InnoDB: 5.6.12 started; log sequence number 1625977 2016-08-30 19:55:46 1377 [Note] Binlog end 2016-08-30 19:55:46 1377 [Note] InnoDB: FTS optimize thread exiting. 2016-08-30 19:55:46 1377 [Note] InnoDB: Starting shutdown... 2016-08-30 19:55:48 1377 [Note] InnoDB: Shutdown completed; log sequence number 1625987 OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /home/mysql/data/mysql/bin/mysqladmin -u root password 'new-password' /home/mysql/data/mysql/bin/mysqladmin -u root -h Master.Hadoop password 'new-password' Alternatively you can run: /home/mysql/data/mysql/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd . ; /home/mysql/data/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems with the ./bin/mysqlbug script! The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com New default config file was created as /home/mysql/data/mysql/my.cnf and will be used by default by the server when you start it. You may edit this file to change server settings WARNING: Default config file /etc/my.cnf exists on the system This file will be read by default by the MySQL server If you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server
配置文件
[mysql@Master scripts]$ cd ../support-files/ [root@Master support-files]# cp my-default.cnf /etc/my.cnf [root@Master support-files]# cp mysql.server /etc/init.d/mysql [root@Master support-files]# vim /etc/init.d/mysql //修改mysql文件
添加以下兩行
basedir=/home/mysql/data/mysql datadir=/home/mysql/data/mysql/data
配置環(huán)境變量
[root@Master support-files]# vim /etc/profile #set mysql environment export MYSQL_HOME=/home/mysql/data/mysql export PATH=$MYSQL_HOME/bin:$PATH
配置mysql服務(wù)開機自動啟動
[root@Master bin]# chkconfig --add mysql //添加mysql [root@Master bin]# chkconfig mysql on //設(shè)置開機啟動
啟動mysql
[root@Master support-files]# service mysql start env: /etc/init.d/mysql: 權(quán)限不夠 //如果出現(xiàn)這個提示 執(zhí)行以下命令重新啟動 [root@Master support-files]# chmod a+wrx /etc/init.d/mysql [root@Master support-files]# service mysql start Starting MySQL.. SUCCESS! //啟動成功
設(shè)置root登錄密碼
[root@Master ~]# cd /home/mysql/data/mysql/bin/ //進去mysql的bin目錄 [root@Master bin]# ./mysqladmin -u root password 'password' //'password' 為自己設(shè)置的密碼引號非必須 [root@Master bin]# ./mysqladmin -u root password mysql [root@Master bin]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.6.12 MySQL Community Server (GPL) Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
以上所述是小編給大家介紹的Linux下安裝mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
MySQL中通過SQL語句刪除重復(fù)記錄并且只保留一條記錄
本文主要介紹了MySQL中通過SQL語句刪除重復(fù)記錄并且只保留一條記錄,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-01-01
MySQL利用procedure analyse()函數(shù)優(yōu)化表結(jié)構(gòu)
不知道是否遇到過為MySQL表結(jié)構(gòu)該選擇什么類型字段而郁悶?或者為MySQL字段該選擇多少長度而糾結(jié)?下面這篇文章就給大家介紹一個武林秘籍吧~也是我最近才學(xué)來的,感興趣的朋友們下面來一起看看吧。2016-12-12
MySQL5.7的sql腳本導(dǎo)入到MySQL5.5出錯3種解決方案
筆者需要將使用MySQL5.7數(shù)據(jù)庫的網(wǎng)站挪入winows服務(wù)器,目標(biāo)服務(wù)器使用的是MySQL5.5,因為兼顧到以前的網(wǎng)站,MySQL不能升級。遇到MySQL5.7的sql腳本導(dǎo)入到MySQL5.5出錯,總結(jié)了3種解決方案,總有一個方案適合你。2023-06-06
如何解決MySQL?this?is?incompatible?with?sql_mode=only_full_
MySQL的ONLY_FULL_GROUP_BY模式要求在使用GROUP?BY時,SELECT語句中引用的所有列必須在GROUP?BY子句中明確指定,或者是聚合函數(shù)的一部分,本文提供了修改SQL語句、使用聚合函數(shù)、禁用ONLY_FULL_GROUP_BY等解決方法,并強調(diào)了在禁用該模式時應(yīng)評估其影響2024-11-11
MySQL數(shù)據(jù)誤刪或者誤更新如何恢復(fù)詳細(xì)步驟(一看就會)
本文主要為開發(fā)人員提供在測試環(huán)境中恢復(fù)近期誤操作的少量數(shù)據(jù)的方法,首先介紹了如何下載并安裝MyFlash工具,然后詳細(xì)講解了如何利用該工具和MySQL的binlog日志來恢復(fù)誤刪或誤更新的數(shù)據(jù),介紹的非常詳細(xì),需要的朋友可以參考下2024-10-10
mac安裝mysql數(shù)據(jù)庫及配置環(huán)境變量的圖文教程
本文主要介紹了mac安裝mysql數(shù)據(jù)庫及配置環(huán)境變量,文中通過圖文代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-08-08
MySQL5.6解壓版服務(wù)無法啟動之系統(tǒng)錯誤1067問題
這篇文章主要介紹了MySQL5.6解壓版服務(wù)無法啟動—系統(tǒng)錯誤1067問題及解決方法,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價值,需要的朋友可以參考下2019-08-08
MySQL數(shù)據(jù)庫中外鍵(foreign?key)用法詳解
這篇文章主要給大家介紹了關(guān)于MySQL數(shù)據(jù)庫中外鍵(foreign?key)的相關(guān)資料,MySQL 外鍵約束可以用來保證表與表之間的關(guān)系完整性,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-10-10

