首頁 > 資料庫 > mysql教程 > MySQL安装_MySQL

MySQL安装_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
發布: 2016-05-27 14:29:42
原創
1140 人瀏覽過

bitsCN.com

Install on Linux

采用二进制方式安装

# 建立用户和组<strong class="userinput"><code><br /></code></strong>shell> <strong class="userinput"><code>groupadd mysql</code></strong><br />shell> <strong class="userinput"><code>useradd -r -g mysql -d /home/mysql -s /bin/bash mysql<br /># 解压安装<br /></code></strong>shell> <strong class="userinput"><code>cd /usr/local</code></strong><br />shell> <strong class="userinput"><code>tar zxvf <em class="replaceable"><code>/path/to/mysql-VERSION-OS</code></em>.tar.gz</code></strong><br />shell> <strong class="userinput"><code>ln -s <em class="replaceable"><code>full-path-to-mysql-VERSION-OS</code></em> mysql</code></strong><br />shell> <strong class="userinput"><code>cd mysql</code></strong><br />shell> <strong class="userinput"><code>chown -R mysql .</code></strong><br />shell> <strong class="userinput"><code>chgrp -R mysql .<br /># 初始化数据库<br /></code></strong>shell> <strong class="userinput"><code>scripts/mysql_install_db --user=mysql</code></strong><br />shell> <strong class="userinput"><code>chown -R root .</code></strong><br />shell> <strong class="userinput"><code>chown -R mysql data</code></strong><br /># Next command is optional<br />shell> <strong class="userinput"><code>cp support-files/my-medium.cnf /etc/my.cnf<br /></code></strong># Next command is optional<br />shell> <strong class="userinput"><code>cp support-files/mysql.server /etc/init.d/mysql.server</code></strong>
登入後複製

<strong class="userinput"><code># 启动和停止<br /></code></strong>shell> <strong class="userinput"><code>bin/mysqld_safe --user=mysql &<br /></code></strong>shell> <strong class="userinput"><code>bin/mysqladmin -uroot shutdown</code></strong>
登入後複製

# 设置root密码
shell> mysql -u root<br /> mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('<em class="replaceable"><code>newpwd');
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('<em class="replaceable"><code>newpwd');
mysql> SET PASSWORD FOR 'root'@'::1' = PASSWORD('<em class="replaceable"><code>newpwd');
mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');

<strong class="userinput"><code># 或者用update语句设置密码<br /></code></strong>shell> <strong class="userinput"><code>mysql -u root</code></strong><br />mysql> <strong class="userinput"><code>UPDATE mysql.user SET Password = PASSWORD('<em class="replaceable"><code>newpwd</code></em>')</code></strong> <strong class="userinput"><code>WHERE User = 'root';</code></strong><br />mysql> <strong class="userinput"><code>FLUSH PRIVILEGES;</code></strong>
登入後複製
bitsCN.com
相關標籤:
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
CentOS7 安裝Docker後啟動失敗
來自於 1970-01-01 08:00:00
0
0
0
安裝類安裝不了啊
來自於 1970-01-01 08:00:00
0
0
0
全域安裝和本機安裝
來自於 1970-01-01 08:00:00
0
0
0
編譯安裝的nginx如何解除安裝?
來自於 1970-01-01 08:00:00
0
0
0
安裝增強安裝包
來自於 1970-01-01 08:00:00
0
0
0
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板