標籤:命令 pass /etc/ move efault date word local 安裝
從mysql網站下載mysql rpm安裝包(包括server、client)
1、安裝server
rpm -ivh MySQL-server-5.6.19-1.el6.x86_64.rpm
強制安裝
rpm -ivh --force MySQL-server-5.5.17-1.linux2.6.x86_64.rpm
報如下錯誤
[[email protected] ~]# rpm -ivh MySQL-server-5.6.19-1.el6.x86_64.rpm --nodepsPreparing... ################################# [100%]
file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.19-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.40-1.el7_0.x86_64
原因是與之前lib庫衝突,解決方式刪除老版本lib庫(注意根據你的提示更改相應版本)
yum -y remove mariadb-libs-1:5.5.40-1.el7_0.x86_64* yum -y remove mysql-libs-*
再次執行 rpm -ivh MySQL-server-5.6.19-1.el6.x86_64.rpm 即可安裝成功
報如下錯誤
[[email protected] tools]# rpm -ivh MySQL-server-5.6.19-1.el6.x86_64.rpm error: Failed dependencies:/usr/bin/perl is needed by MySQL-server-5.6.19-1.el6.x86_64libaio.so.1()(64bit) is needed by MySQL-server-5.6.19-1.el6.x86_64libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.19-1.el6.x86_64libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.6.19-1.el6.x86_64
需要安裝 libaio
報如下錯誤,錯少perl安裝perl
error: Failed dependencies: /usr/bin/perl is needed by MySQL-server-5.6.19-1.el6.x86_64
安裝perl
yum install perl
2、啟動mysql
啟動
service mysql start
停止
service mysql stop
重啟
service mysql restart
查看當前mysql狀態
service mysql status
3、安裝client
rpm -ivh MySQL-client-5.6.19-1.el6.x86_64.rpm
4、用戶端登陸
mysql -uroot -p
5、mysql初始化
[[email protected] mysql]# /usr/bin/mysql_install_db[[email protected] mysql]# service mysql start[[email protected] mysql]# cat /root/.mysql_secret# The random password set for the root user at Sat Feb 7 10:54:24 2015 (local time): VoKvw3vpo_3LiA3c[[email protected] mysql]# mysql -uroot -pVoKvw3vpo_3LiA3cmysql> SET PASSWORD = PASSWORD(‘2345678‘);mysql> exit[[email protected] mysql]# mysql -uroot -p2345678
6、遠程登入配置
mysql> use mysqlmysql> select host ,user ,password from user;+-----------+------+-------------------------------------------+| host | user | password |+-----------+------+-------------------------------------------+| localhost | root | *BC1C4715C23459AB982AD2D6617B4F8790161763 || xcldtc5m | root | *44CF61DA6CDeeee2085F4598F728CF221DA8F167 || 127.0.0.1 | root | *44CF61DA6CD83e32085F4598F728CF221DA8F167 || ::1 | root | *44CF61DA6CD86832345F4598F728CF221DA8F167 |+-----------+------+-------------------------------------------+mysql> update user set password=password(‘234567‘) where user=‘root‘;mysql> update user set host=‘%‘ where host=‘localhost‘;
重新啟動mysql或是重新整理
7、設定開機自啟動
[[email protected] mysql]# chkconfig mysql on[[email protected] mysql]# chkconfig --list | grep mysqlmysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
8、查看mysql設定檔位
[[email protected] mysql]# mysqld --verbose --help | grep -A 1 ‘Default options‘
9、MYSQL預設安裝位置
/var/lib/mysql/ #資料庫目錄 /usr/share/mysql #設定檔目錄/usr/bin #相關命令目錄 /etc/init.d/mysql #啟動指令碼
10、更改mysql預設引擎為Innodb
在設定檔my.ini中的 [mysqld] 下面加入default-storage-engine=INNODB
之後重啟即可
centos6.5 使用 rpm 安裝 mysql