http://dev.mysql.com/downloads/mysql/node
或者使用wget下載:mysql
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.22-1.el6.i686.rpm-bundle.tarc++
rpm -qa | grep mysqlsql
若是已經安裝了,將其卸載,如:數據庫
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64緩存
一、 mkdir /usr/local/src/mysql
二、 cd /usr/local/src/mysql
三、 tar -xvf MySQL-5.6.22-1.el6.i686.rpm-bundle.tar
四、 安裝server
rpm -ivh MySQL-server-5.6.22-1.el6.i686.rpm
出錯:安裝依賴:yum -y install libaio.so.1 libgcc_s.so.1 libstdc++.so.6
須要升級libstdc++-4.4.7-4.el6.x86_64
yum update libstdc++-4.4.7-4.el6.x86_64
五、 安裝client
安裝依賴:yum -y install libncurses.so.5 libtinfo.so.5
六、 查詢mysq服務運行狀態
service mysql status
七、 啓動mysql服務
service mysql start
八、 使用root帳號登陸mysql
在安裝mysql server時有句提示:
注意:這個密碼是不安全的,全部須要修改初始密碼。
1)進入該文件查看密碼安全
vi /root/.mysql_secretsocket
2)使用這個密碼登陸mysqltcp
mysql –uroot –p密碼ide
3)修改密碼
SET PASSWORD = PASSWORD('123');
加入到系統服務:
chkconfig --add mysql
自動啓動:
chkconfig mysql on
查詢列表:
chkconfig
說明:都沒關閉(off)時是沒有自動啓動。
登陸:
mysql -uroot –p123456
設置遠程訪問(使用root密碼):
grant all privileges on . to 'root' @'%' identified by '123456';
flush privileges;
防火牆打開3306端口
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
/etc/init.d/iptables status
Linux下用rpm包安裝的MySQL是不會安裝/etc/my.cnf文件的,
至於爲何沒有這個文件而MySQL卻也能正常啓動和做用,在點有兩個說法,
第一種說法,my.cnf只是MySQL啓動時的一個參數文件,能夠沒有它,這時MySQL會用內置的默認參數啓動,
第二種說法,MySQL在啓動時自動使用/usr/share/mysql目錄下的my-medium.cnf文件,這種說法僅限於rpm包安裝的MySQL,
解決方法,只須要複製一個/usr/share/mysql目錄下的.cnf文件到/etc目錄,並更名爲my.cnf便可。
(我這裏直接修改了複製過來的文件,把下面那段複製到了文件中)
[client] #no-beep port=3306 [mysql] default-character-set=utf8 socket = /var/lib/mysql/mysql.sock [mysqld] # The TCP/IP Port the MySQL Server will listen on port=3306 socket = /var/lib/mysql/mysql.sock character-set-server=utf8 #默認引擎設置爲INNODB,這要看你的數據庫是作什麼用的 default-storage-engine=INNODB #最大鏈接數,這個說實話,我沒有測出來最合理的數值 max_connections = 500 #下面這兩個參數就是禁用緩存查詢,主要是由於個人數據庫大量的寫操做,因此設置了cache,反而會影響性能,也是基於理論上的,因此你大可沒必要相信。 query_cache_size=0 query_cache_type=0 #這幾個數值,你千萬要找度娘理論一下啊,我是說不清楚了 table_open_cache=2000 tmp_table_size=19M thread_cache_size = 18 myisam_max_sort_file_size = 1G myisam_sort_buffer_size=30M key_buffer_size=8M read_buffer_size = 512K read_rnd_buffer_size = 1M sort_buffer_size = 512k #這個很重要了,對性能有着很大的影響,我會告訴你的。 innodb_flush_log_at_trx_commit=2 innodb_log_buffer_size=1M # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. innodb_buffer_pool_size=2G innodb_buffer_pool_instances=1 #上面這兩個參數對性能的做用我會論證給你的。 #這一塊參數的做用我也忘的差很少了,因此度娘吧 innodb_log_file_size=48M innodb_thread_concurrency=9 innodb_autoextend_increment=64 innodb_buffer_pool_instances=8 innodb_concurrency_tickets=5000 innodb_old_blocks_time=1000 innodb_open_files=300 innodb_stats_on_metadata=0 innodb_file_per_table=1 innodb_checksum_algorithm=0 flush_time=0 join_buffer_size=256K max_connect_errors=100 max_allowed_packet = 16M open_files_limit=4161 table_definition_cache=1400 binlog_row_event_max_size=8K #二進制的類型,這個有很大學問,稍候我也會告訴你的。 binlog-format = MIXED #事務鎖時間,這個一樣學問很大。 innodb_lock_wait_timeout = 20 #事務鎖級別,這個學問一樣很大很大啊 transaction-isolation = REPEATABLE-READ binlog_cache_size = 1M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. #這個參數就是設置二進制文件的路徑的,注意啊,注意啊! log_bin=mysql-bin server_id = 1 [mysqldump] max_allowed_packet = 16M
原文:https://blog.csdn.net/qing_gee/article/details/49507817 原文:https://blog.csdn.net/qing_gee/article/details/49507817