linux——mysql

來源:互聯網
上載者:User

標籤:usr   art   pre   檔案   vim   lis   size   oca   upd   

一、mysql 安裝

  查看是否安裝了 mysql  

  rpm -qa | grep mysql-server

 yum install  mysql-server

 修改設定檔

 vim /etc/my.cnf

  

  設定系統服務啟動

  chkconfig mysqld on    

  查看設定狀態

  chkconfig  --list mysqld

  

  啟動 mysql 

  service mysql restart 

  (start stop)

  若無法啟動,如下命令啟動

  /etc/rc.d/init.d/mysqld start

  

 二、問題

   查看mysqld的log檔案 

         less /var/log/mysqld.log  

  (1) mysql.sock 不存在   連結   ---  >  https://www.linuxidc.com/Linux/2009-09/21897.htm

  

  解決方案:

  /etc/init.d/mysqld stop

1 $/usr/local/bin/mysql_install_db     //重建授權表3 $/usr/local/bin/mysqld_safe &      

  /etc/init.d/mysqld start 

  登入 mysql  

  # mysql

  (2) Access denied for user ‘root‘@‘localhost

    

# /etc/rc.d/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD(‘newpassword‘) where USER=‘root‘;
mysql> FLUSH PRIVILEGES;
mysql> quit

# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password: <輸入新設的密碼newpassword>

mysql>

 

linux——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.