CentOS 5/6 使用YUM安裝MySQL 5.5
==============================
最簡單明了的方式安裝MYSQL 5.5
1.使用 Webtatic YUM 源
對于 CentOS/RHEL 6.x
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
對于 CentOS/RHEL 5.x
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
已經安裝了早前版本,升級
~~~
If you already have MySql client or server installed (rpm -q mysql mysql-server), then you can upgrade using the following method:
yum install mysql.`uname -i` yum-plugin-replace
yum replace mysql --replace-with mysql55w
“yum install mysql” is only there to make sure yum-plugin-replace can resolve dependencies correctly if only mysql-server was installed.
~~~
全新安裝MySQL 5.5
yum install mysql55w mysql55w-server
You should upgrade existing tables before setting the server to become a production machine, which can be done by starting the server and running the mysql_upgrade script (this may take time depending on the size of the database).
service mysqld start
This will issue a password prompt for the user. If you don't have a root user password, remove the "-p"
mysql_upgrade -u root -p
----
安裝完成后安全配置
--
mysql_secure_installation
2、啟動、停止設置
--
數據庫字符集設置
mysql配置文件/etc/my.cnf中加入
default-character-set=utf8
啟動mysql服務:
service mysqld start
或者/etc/init.d/mysqld start
設置開機啟動:
chkconfig -add mysqld
查看開機啟動設置是否成功
chkconfig --list | grep mysql*
mysqld 0:關閉 1:關閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關閉
停止mysql服務:
service mysqld stop
3、登錄及忘記修改密碼
創建root管理員:
mysqladmin -u root password 666666
登錄:
mysql -u root -p
如果忘記密碼,則執行以下代碼
~~~
service mysqld stop
mysqld_safe --user=root --skip-grant-tables
mysql -u root
use mysql
update user set password=password("666666") where user="root";
flush privileges;
~~~
4、允許遠程訪問設置
開放防火墻的端口號
mysql增加權限:mysql庫中的user表新增一條記錄host為“%”,user為“root”。
use mysql;
UPDATE user SET `Host` = '%' WHERE `User` = 'root' LIMIT 1;
%表示允許所有的ip訪問
5、mysql的幾個重要目錄
(a)數據庫目錄
/var/lib/mysql/
(b)配置文件
/usr/share /mysql(mysql.server命令及配置文件)
(c)相關命令
/usr/bin(mysqladmin mysqldump等命令)
(d)啟動腳本
/etc/rc.d/init.d/(啟動腳本文件mysql的目錄)
---
附:此臺服務器的my.cnf配置
skip-locking
skip-name-resolve
key_buffer = 1024M
back_log = 3000
max_allowed_packet = 4M
table_cache = 512
sort_buffer_size = 8M
read_buffer_size = 8M
myisam_sort_buffer_size = 1024M
thread_cache = 512
query_cache_size = 512M
set-variable = wait_timeout=60
thread_concurrency = 4
log-slow-queries = slow.log
long_query_time = 1
innodb_flush_log_at_trx_commit = 2
innodb_buffer_pool_size = 1024M
#innodb_locks_unsafe_for_binlog = 1
如果不是升級,而是新安裝。還需要設置root密碼,刪除默認的空用戶、空密碼等等........
- 0 綜合性知識庫
- 1 前端資源
- 2 電子書籍和搜索工具
- 3 數據庫
- 3.1 MySQL工具
- 3.2 YUM安裝MySQL 5.5
- 3.3 MySQL升級
- 3.4 MySQL主從復制
- 3.5 Lepus數據庫監控工具
- 4 應用服務器
- 4.1 Apache
- 4.2 Ngnix
- 4.3 Kangle
- 4.4 各種一鍵包
- 4.5 應用服務器APP API
- 5 語言和腳本工具
- 5.1 安裝PHP多版本
- 5.2 YUM升級PHP5.6
- 5.2 Python升級2.7
- 5 MarkDown
- 6 Git
- 7 云計算VPS供應商
- 700 服務器Linux技術
- 7.1 服務器查找工具
- 701 服務器可視化技術
- 800 發布相關素材
- 997 模板類內容
- 9971 翻譯模板一