特殊:Badtitle/NS100:DinkelVersus/MySQLServer
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/DinkelVersus/MySQLServer }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/af | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|Afrikaans| [[::DinkelVersus/MySQLServer/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/ar | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|العربية| [[::DinkelVersus/MySQLServer/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/az | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|azərbaycanca| [[::DinkelVersus/MySQLServer/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/bcc | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|جهلسری بلوچی| [[::DinkelVersus/MySQLServer/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/bg | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|български| [[::DinkelVersus/MySQLServer/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/br | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|brezhoneg| [[::DinkelVersus/MySQLServer/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/ca | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|català| [[::DinkelVersus/MySQLServer/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/cs | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|čeština| [[::DinkelVersus/MySQLServer/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/de | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|Deutsch| [[::DinkelVersus/MySQLServer/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/el | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|Ελληνικά| [[::DinkelVersus/MySQLServer/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/es | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|español| [[::DinkelVersus/MySQLServer/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/fa | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|فارسی| [[::DinkelVersus/MySQLServer/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/fi | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|suomi| [[::DinkelVersus/MySQLServer/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/fr | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|français| [[::DinkelVersus/MySQLServer/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/gu | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|ગુજરાતી| [[::DinkelVersus/MySQLServer/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/he | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|עברית| [[::DinkelVersus/MySQLServer/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/hu | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|magyar| [[::DinkelVersus/MySQLServer/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/id | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|Bahasa Indonesia| [[::DinkelVersus/MySQLServer/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/it | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|italiano| [[::DinkelVersus/MySQLServer/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/ja | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|日本語| [[::DinkelVersus/MySQLServer/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/ko | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|한국어| [[::DinkelVersus/MySQLServer/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/ksh | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|Ripoarisch| [[::DinkelVersus/MySQLServer/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/mr | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|मराठी| [[::DinkelVersus/MySQLServer/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/ms | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|Bahasa Melayu| [[::DinkelVersus/MySQLServer/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/nl | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|Nederlands| [[::DinkelVersus/MySQLServer/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/no | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|norsk| [[::DinkelVersus/MySQLServer/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/oc | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|occitan| [[::DinkelVersus/MySQLServer/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/pl | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|polski| [[::DinkelVersus/MySQLServer/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/pt | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|português| [[::DinkelVersus/MySQLServer/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/ro | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|română| [[::DinkelVersus/MySQLServer/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/ru | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|русский| [[::DinkelVersus/MySQLServer/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/si | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|සිංහල| [[::DinkelVersus/MySQLServer/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/sq | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|shqip| [[::DinkelVersus/MySQLServer/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/sr | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|српски / srpski| [[::DinkelVersus/MySQLServer/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/sv | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|svenska| [[::DinkelVersus/MySQLServer/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/th | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|ไทย| [[::DinkelVersus/MySQLServer/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/tr | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|Türkçe| [[::DinkelVersus/MySQLServer/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/vi | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|Tiếng Việt| [[::DinkelVersus/MySQLServer/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/yue | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|粵語| [[::DinkelVersus/MySQLServer/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/zh | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|中文| [[::DinkelVersus/MySQLServer/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/zh-hans | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|中文(简体)| [[::DinkelVersus/MySQLServer/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DinkelVersus/MySQLServer | UbuntuHelp:DinkelVersus/MySQLServer | {{#if: | :}}DinkelVersus/MySQLServer}}/zh-hant | • {{#if: UbuntuHelp:DinkelVersus/MySQLServer|中文(繁體)| [[::DinkelVersus/MySQLServer/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:DinkelVersus/MySQLServer|:DinkelVersus/MySQLServer|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :DinkelVersus/MySQLServer/zh | | {{#ifexist: DinkelVersus/MySQLServer/zh | | {{#ifeq: {{#titleparts:DinkelVersus/MySQLServer|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:DinkelVersus/MySQLServer|1|-1|}} | zh | | }}
Introduction
Your database server should be it's own server with no other services (such as web or email) on it. First thing, follow the DinkelServerBase in order to get a basic server set up, and a uniform environment to install MySQL server on.
Make Space
While the virtual machine is powered off, add a second harddrive. The size of this varies on how much use your database server is going to get, but it is best to judge small because the harddrive can easily be expanded, but it is definately not as easy to shrink after it has been in production and you need to reclaim space on the virtual machine host server. 10 to 20 GB is probably plenty of starting space. Power on the virtual machine. Log into this server's Webmin from a workstation and partition the hard drive as a single XFS partition mounted at /var/lib/mysql which is where all the databases are stored by default.
Install MySQL Server
sudo apt-get update && sudo apt-get -y install mysql-server
This will install the latest mysql-server.
sudo nano /etc/mysql/my.cnf
Put a # in front of the line bind-address = 127.0.0.1
so it reads like this:
# bind-address = 127.0.0.1
This will allow access from other servers, particularly the webserver. We will be restricting access to only the servers that need it through the firewall.
Firewall
Use Webmin to open up firewall port TCP 3306, but I would suggest only allowing the computers that would be accessing it (based on IP). Also, use Webmin to disable and stop mysql-ndb and mysql-ndb-mgm (from the Bootup and Shutdown module). These two daemons are only needed for clustering.
Configure MySQL
Restart the mysql daemon (to get the my.cnf change) with:
sudo /etc/init.d/mysql restart
Set a password for the MySQL root user with
mysqladmin –u root password ‘new-password’
You might need sudo in front of this line, for the life of me I can not remember at the moment; I will check later. Allow access from remote hosts with this (do not type the >, those are only to show you are in the mysql program):
mysql –u root –p > GRANT ALL PRIVILEGES ON *.* TO root@’%’ IDENTIFIED BY ‘new-password’ WITH GRANT OPTION; > quit
phpMyAdmin
You’ll now want to install phpMyAdmin on the webserver. Follow my instructions for setting up an Apache server DinkelVersus/ApacheServer, or use your existing web server with php installed. Here are the directions for putting it on my Apache setup. The only thing that might be different is the path to where you put files.
cd ~ wget http://superb-east.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.10.0.2-english.tar.bz2
You can find the latest version of phpMyAdmin at http://www.phpmyadmin.net/home_page/index.php
tar –xjf phpMyAdmin-2.10.0.2-english.tar.bz2 cd phpMyAdmin-2.10.0.2-english sudo mkdir /var/www/phpmyadmin sudo mv * /var/www/phpmyadmin/ sudo nano /var/www/phpmyadmin/config.inc.php
Insert the following:
<?php /* * Generated configuration file * Generated by: phpMyAdmin 2.8.1 setup script by Michal Cihar * Version: $Id: setup.php,v 1.23.2.8.2.2 2006/05/15 07:57:09 nijel Exp $ * Date: Sun, 11 Jun 2006 17:34:57 GMT */ /* Servers configuration */ $i = 0; $i++; $cfg['Servers'][$i]['host'] = 'sql.svr.ip.addy'; $cfg['Servers'][$i]['extension'] = 'mysql'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['auth_type'] = 'http'; /* End of servers configuration */ ?>
Be sure to change sql.svr.ip.addy to the ip address of the MySQL server.
sudo nano /etc/apache2/sites-available/default
Add the Alias directive to the virtual host:
<VirtualHost *> Alias /phpmyadmin /var/www/phpmyadmin ...
sudo /etc/init.d/apache2 restart
You can now browse to http://webserver/phpmyadmin
and have at it. Log in with the root user and password you set up above with the mysqladmin command.