MySQL安裝配置

來源:互聯網
上載者:User

標籤:

MySQL安裝配置

作業系統環境:redhat6.5 x64

MySQL版本:5.6.25

Mysql管理工具:Navicat for mysql 11.1.12

1、 下載安裝軟體

登入MySQL官網下載:http://www.mysql.com/downloads/

Oracle單一使用者登入

選擇軟體及平台:

下載:

2、 安裝MySQL

     可參考文檔:http://dev.mysql.com/doc/refman/5.6/en/linux-installation.html

     2.1 建立使用者

Useradd mysqlPasswd mysql  //設定密碼

     2.2 解壓軟體包

[[email protected] soft]# unzip V76360-01-rhel6.zip

    2.3 rpm安裝

[[email protected] soft]# rpm -ivh MySQL-server-advanced-5.6.25-1.el6.x86_64.rpm[[email protected] soft]# rpm -ivh MySQL-client-advanced-5.6.25-1.el6.x86_64.rpm

     註:In most cases, you need to install only the MySQL-server and MySQL-client packages to get a functional MySQL installation

     安裝後在Linux系統中目錄結構:

Directory

Contents of Directory

/usr/bin

Client programs and scripts

/usr/sbin

The mysqld server

/var/lib/mysql

Log files, databases

/usr/share/info

MySQL manual in Info format

/usr/share/man

Unix manual pages

/usr/include/mysql

Include (header) files

/usr/lib/mysql

Libraries

/usr/share/mysql

Miscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation

/usr/share/sql-bench

Benchmarks

3、MySQL啟動與停止

    MySQL安裝完成後開機檔案mysql在 /etc/init.d下

    啟動

[[email protected] bin]# /etc/rc.d/init.d/mysql startStarting MySQL.. SUCCESS!

   停止

/usr/bin/mysqladmin -u root -p shutdown

4、配置遠端連線

mysql> GRANT ALL PRIVILEGES ON *.* TO [email protected]‘%‘ IDENTIFIED BY ‘password‘;Query OK, 0 rows affected (0.01 sec)mysql>  FLUSH PRIVILEGES;

5、安裝時遇見的問題

    安裝過程中遇見了幾個問題,網上搜尋答案解決,謝謝大家的分享。在此再次總結一下

    問題1:系統已安裝包的衝突

   

    解決

[[email protected] soft]# rpm -qa |grep mysql  //尋找衝突的包mysql-libs-5.1.71-1.el6.x86_64[[email protected] soft]# yum -y remove mysql-libs-5.1.71-1.el6.x86_64  //卸載該包再次安裝

   問題2:安裝完成後MySQL未啟動

   安裝完成後,未啟動就開始串連MySQL,報錯如下:

  [[email protected] soft]# mysql

  ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2)

   解決:啟動MySQL即可

   問題3:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)

   解決:

[[email protected] bin]# /etc/init.d/mysql stop  //強行停止MySQL[[email protected] bin]# /usr/bin/mysqld_safe --skip-grant-tables --skip-networking &  //[[email protected] bin]# mysql -u root mysqlmysql> update user set Password=PASSWORD(‘password‘) where user=‘root‘;Query OK, 4 rows affected (0.00 sec)Rows matched: 4  Changed: 4  Warnings: 0mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec)mysql> quit[[email protected] bin]# /etc/init.d/mysql restart //重啟兩遍[[email protected] bin]# mysql -u root mysqlmysql> SET PASSWORD=PASSWORD(‘passw0rd‘); //需執行此命令才能繼續執行其他命令

MySQL安裝配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.