MySQL Linux壓縮版安裝方法(下)
上篇中我們進行了初步的安裝配置,本篇繼續進行問題解決。
7、Warning警告分析
在實驗mysqld啟動的時候,我們看到了一條Warning告警資訊。
[mysql@bspdev mysql-5.5.25-linux2.6-i686]$ mysqld &
[1] 28398
[mysql@bspdev mysql-5.5.25-linux2.6-i686]$ 120701 4:21:42 [Warning] Changed limits: max_open_files: 1024 max_connections: 151 table_cache: 431
120701 4:21:42 [Note] Plugin 'FEDERATED' is disabled.
雖然告警資訊不是什麼重要問題,但是還是需要稍微關注一下。
從提示內容上看,似乎是關於使用者連線數、同時開啟檔案數目和快取的一些內容,存在限制。這讓我們想起了Oracle在安裝時,進行的作業系統使用者限制開啟過程。查閱資料後,只需要將mysql使用者的限制開啟就可以了。
[mysql@bspdev mysql-5.5.25-linux2.6-i686]$ ulimit -Sa | grep "open files"
open files (-n) 1024
[mysql@bspdev mysql-5.5.25-linux2.6-i686]$ ulimit -Ha | grep "open files"
open files (-n) 1024
[mysql@bspdev mysql-5.5.25-linux2.6-i686]$ su - root
Password:
--修改/etc/security/limits.conf檔案內容;
[root@bspdev ~]# vi /etc/security/limits.conf
# /etc/security/limits.conf
#
#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
#新增內容;
mysql hard nofile 8192
mysql soft nofile 1200
再嘗試開啟伺服器,warning資訊消失。
[root@bspdev ~]# su - mysql
[mysql@bspdev ~]$ mysqld &
[1] 16285
[mysql@bspdev ~]$ 120701 4:26:21 [Note] Plugin 'FEDERATED' is disabled.
120701 4:26:21 InnoDB: The InnoDB memory heap is disabled
120701 4:26:21 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
120701 4:26:21 InnoDB: Compressed tables use zlib 1.2.3
120701 4:26:21 InnoDB: Using Linux native AIO
(篇幅原因,有省略……)
[mysql@bspdev ~]$ ps -ef | grep mysqld
mysql 16285 16257 1 04:26 pts/0 00:00:00 mysqld
mysql 16304 16257 0 04:26 pts/0 00:00:00 grep mysqld
8、使用者密碼問題
本地連線成功之後,筆者嘗試使用遠端連線。結果發現linux版本的一些安全限制。
--從遠端機器連線;
C:\Users\51ibm>mysql -h 192.168.137.89 -u root
ERROR 1130 (HY000): Host '192.168.137.1' is not allowed to connect to this MySQL
server
此時,MySQL伺服器端日誌記錄錯誤資訊。
[Warning] IP address '192.168.137.1' could not be resolved: Temporary failure in name resolution
從資訊上看,應該是登入存在一些限制內容。
[mysql@bspdev ~]$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.25-log MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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> use mysql
Database changed
mysql> select host, name, password from user;
ERROR 1054 (42S22): Unknown column 'name' in 'field list'
mysql> select host, user, password from user;
+--------------------+------+----------+
| host | user | password |
+--------------------+------+----------+
| localhost | root | |
| bspdev.localdomain | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| bspdev.localdomain | | |
+--------------------+------+----------+
6 rows in set (0.00 sec)
mysql>
注意,在許可權表中,沒有針對其他ip登陸的許可許可權。說明Linux版本預設情況下,允許本地登陸,沒有密碼要求。但是不允許使用者從其他客戶端進行登陸。
我們需要人工的加以授權。
mysql> grant all on *.* to root@'%' identified by 'root' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> select host, user, password from user;
+--------------------+------+-------------------------------------------+
| host | user | password |
+--------------------+------+-------------------------------------------+
| localhost | root | |
| bspdev.localdomain | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| bspdev.localdomain | | |
| % | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+--------------------+------+-------------------------------------------+
7 rows in set (0.00 sec)
此時,我們可以從非伺服器進行登陸,而且必須輸入密碼。
--不輸入使用者密碼登入,被拒絕;
C:\Users\51ibm>mysql -h 192.168.137.89 -u root
ERROR 1045 (28000): Access denied for user 'root'@'192.168.137.1' (using passwor
d: NO)
--輸入root使用者密碼,透過;
C:\Users\51ibm>mysql -h 192.168.137.89 -u root -proot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.25-log MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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>
額外說明,從那張user表中,我們可以構建這樣的許可權體系。相同的使用者名稱,從不同的機器上登陸時使用不同的密碼。
9、Linux服務化
在Windows中,我們是將MySQL作為一項服務,新增在服務列表中進行啟動關閉管理。在Linux中,我們也可以使用相同的配置內容。
--首先關閉mysqld服務
[mysql@bspdev ~]$ ps -ef | grep mysqld
mysql 16285 1 0 04:26 ? 00:00:00 mysqld
mysql 16475 16442 0 04:37 pts/2 00:00:00 grep mysqld
[mysql@bspdev ~]$ mysqladmin -u root shutdown
[mysql@bspdev ~]$ ps -ef | grep mysqld
mysql 16481 16442 0 04:38 pts/2 00:00:00 grep mysqld
[mysql@bspdev ~]$
將mysqld作為服務新增到列表中。
[root@bspdev ~]# cd /mysql/mysql-5.5.25-linux2.6-i686/support-files/
[root@bspdev support-files]# cp mysql.server /etc/rc.d/init.d/mysqld
[root@bspdev support-files]# chmod 700 /etc/init.d/mysqld
[root@bspdev support-files]# chkconfig --add mysqld
[root@bspdev support-files]# chkconfig --level 345 mysqld on
之後,我們就可以透過service mysqld start來啟動MySQL資料庫了。
[root@bspdev support-files]# service mysqld start
Starting MySQL...[ OK ]
[root@bspdev support-files]# mysql -u root
-bash: mysql: command not found
[root@bspdev support-files]# su - mysql
[mysql@bspdev ~]$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.25-log MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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>
對service命令,我們還可以使用如status、stop等命令。
[root@bspdev ~]# service mysqld status
MySQL running (16839)[ OK ]
[root@bspdev ~]# service mysqld stop
Shutting down MySQL.[ OK ]
[root@bspdev ~]# ps -ef | grep mysqld
root 16988 16902 0 04:44 pts/2 00:00:00 grep mysqld
[root@bspdev ~]#
10、結論
作為目前最流行的開源資料庫產品,MySQL是比較成功的。學習安裝MySQL,只是學習的一個開始入手點。之後,還有很多的問題需要解決和學習,需要不斷的堅持和努力才能完成。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17203031/viewspace-734590/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL Linux壓縮版安裝方法(上)MySqlLinux
- Mac安裝壓縮版MySQL ServerMacMySqlServer
- Windows下安裝MySQL解壓版WindowsMySql
- 解壓縮版mysql安裝及注意事項MySql
- MySQL綠色解壓縮版安裝與配置MySql
- centos7安裝mysql5.7解壓縮版CentOSMySql
- Linux下常用壓縮格式的壓縮與解壓方法Linux
- 如何下載安裝壓縮包
- MySQL壓縮版教程MySql
- Linux下常用壓縮格式的壓縮與解壓方法---轉載Linux
- linux下壓縮解壓縮命令Linux
- linux 7z壓縮安裝Linux
- unix和linux下常用壓縮格式的壓縮與解壓方法(轉)Linux
- MySQL:mysql5.7解壓版安裝與解除安裝MySql
- mysql5.7.x用壓縮包安裝MySql
- mysql在linux上cmake安裝方法(自己安裝版)MySqlLinux
- Linux下壓縮,解壓縮RAR包(轉)Linux
- Mysql5.6壓縮包安裝到windows&& 解除安裝命令MySqlWindows
- Linux下如何安裝、壓縮、解壓軟體包?常用命令彙總!Linux
- linux下的檔案的壓縮和解壓縮Linux
- linux下壓縮、解壓命令大全Linux
- Linux下安裝、解除安裝mysqlLinuxMySql
- mysql linux下安裝MySqlLinux
- Linux下Mysql安裝LinuxMySql
- linux 下安裝mysqlLinuxMySql
- linux下安裝MysqlLinuxMySql
- Linux下Mysql5.7.19解除安裝方法LinuxMySql
- mysql5.7.22解壓版安裝教程MySql
- mysql-8.4.0解壓版安裝記錄MySql
- Linux下的tar壓縮解壓縮命令詳解Linux
- Linux各種壓縮與解壓方法Linux
- 【MySQL安裝】Linux下安裝MySQL(預編譯)MySqlLinux編譯
- [linux]linux下安裝mysqlLinuxMySql
- linux壓縮解壓縮Linux
- Linux下zip壓縮和unzip解壓縮命令全解Linux
- 安裝解壓版mysql(mysql-5.5.24),出錯記錄。MySql
- Windows Server 2012下MySQL 5.7解壓版(zip)安裝配置WindowsServerMySql
- Linux 編譯安裝、壓縮打包、定時任務Linux編譯