Heim > Datenbank > MySQL-Tutorial > Hauptteil

MySQL安装_MySQL

WBOY
Freigeben: 2016-05-27 14:29:42
Original
1064 Leute haben es durchsucht

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>
Nach dem Login kopieren

<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>
Nach dem Login kopieren

# 设置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>
Nach dem Login kopieren
bitsCN.com
Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!