MySQL ÃüÁîÐÐ
MySQL ÃüÁîÐÐ
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö²ÎÊý-h»úÆ÷IP
µÚÈýÕС¢Ôö¼ÓÐÂÓû§
¸ñʽ£ºgrant ȨÏÞ on Êý¾Ý¿â.* to Óû§Ãû@µÇ¼Ö÷»ú identified by "ÃÜÂë"
È磬Ôö¼ÓÒ»¸öÓû§user1ÃÜÂëΪpassword1£¬ÈÃÆä¿ÉÒÔÔÚ±¾»úÉϵǼ£¬ ²¢¶ÔËùÓÐÊý¾Ý¿âÓвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄȨÏÞ¡£Ê×ÏÈÓÃÒÔrootÓû§Á¬Èëmysql£¬È»ºó¼üÈëÒÔÏÂÃüÁ
grant select,insert,update,delete on *.* to user1@localhost Identified by "password1";
Èç¹ûÏ£Íû¸ÃÓû§Äܹ»ÔÚÈκλúÆ÷Éϵǽmysql£¬Ôò½«localhost¸ÄΪ"%"¡£
Èç¹ûÄã²»Ïëuser1ÓÐÃÜÂ룬¿ÉÒÔÔÙ´òÒ»¸öÃüÁÃÜÂëÈ¥µô¡£
grant select,insert,update,delete on mydb.* to user1@localhost identified by "";
µÚËÄÕУº ²Ù×÷Êý¾Ý¿â
µÇ¼µ½mysqlÖУ¬È»ºóÔÚmysqlµÄÌáʾ·ûÏÂÔËÐÐÏÂÁÐÃüÁÿ¸öÃüÁîÒԷֺŽáÊø¡£
1¡¢ ÏÔʾÊý¾Ý¿âÁÐ±í¡£
show databases;
ȱʡÓÐÁ½¸öÊý¾Ý¿â£ºmysqlºÍtest¡£ mysql¿â´æ·Å×ÅmysqlµÄϵͳºÍÓû§È¨ÏÞÐÅÏ¢£¬ÎÒÃǸÄÃÜÂëºÍÐÂÔöÓû§£¬Êµ¼ÊÉϾÍÊǶÔÕâ¸ö¿â½øÐвÙ×÷¡£
2¡¢ ÏÔʾ¿âÖеÄÊý¾Ý±í£º
use mysql;
show tables;
3¡¢ ÏÔʾÊý¾Ý±íµÄ½á¹¹£º
describe ±íÃû;
4¡¢ ½¨¿âÓëɾ¿â£º
create database ¿âÃû;
drop database ¿âÃû;
5¡¢ ½¨±í£º
use ¿âÃû;
create table ±íÃû(×Ö¶ÎÁбí);
drop table ±íÃû;
6¡¢ Çå¿Õ±íÖмǼ£º
delete from ±íÃû;
7¡¢ ÏÔʾ±íÖеļǼ£º
select * from ±íÃû;
µÚÎåÕС¢µ¼³öºÍµ¼ÈëÊý¾Ý
1. µ¼³öÊý¾Ý£º
mysqldump --opt test > mysql.test
¼´½«Êý¾Ý¿âtestÊý¾Ý¿âµ¼³öµ½mysql.testÎļþ£¬ºóÕßÊÇÒ»¸öÎı¾Îļþ
È磺mysqldump -u root -p123456 --databases dbname > mysql.dbname
¾ÍÊÇ°ÑÊý¾Ý¿âdbnameµ¼³öµ½Îļþmysql.dbnameÖС£
2. µ¼ÈëÊý¾Ý:
mysqlimport -u root -p123456 < mysql.dbname¡£
²»ÓýâÊÍÁË°É¡£
3. ½«Îı¾Êý¾Ýµ¼ÈëÊý¾Ý¿â:
Îı¾Êý¾ÝµÄ×Ö¶ÎÊý¾ÝÖ®¼äÓÃtab¼ü¸ô¿ª¡£
use test;
load data local infile "ÎļþÃû" into table ±íÃû;
1:ʹÓÃSHOWÓï¾äÕÒ³öÔÚ·þÎñÆ÷Éϵ±Ç°´æÔÚʲôÊý¾Ý¿â£º
mysql> SHOW DATABASES;
2:2¡¢´´½¨Ò»¸öÊý¾Ý¿âMYSQLDATA
mysql> CREATE DATA
Ïà¹ØÎĵµ£º
1¡¢ÏµÍ³¹ÜÀí
¡¡¡¡mysql -hÖ÷»úµØÖ· -uÓû§Ãû -p
¡¡¡¡Á¬½ÓMYSQL(ÔÚmysql/bin)
¡¡¡¡exit
¡¡¡¡Í˳öMYSQLÃüÁî
¡¡¡¡mysqladmin -uÓû§Ãû -p¾ÉÃÜÂë passwordÐÂÃÜÂë
¡¡¡¡ÐÞ¸ÄÃÜÂë(ÔÚmysql/bin)
¡¡¡¡grantselect[insert][,update][,delete]onÊý¾Ý¿â.*toÓû§Ãû@localhost("%"£¬ ±íʾÈκÎÖ÷»ú)identifiedby "ÃÜÂë"
¡¡¡¡ ......
$sudo nano /etc/apparmor.d/usr.sbin.mysqld
ÔÚgeditÖÐÕÒµ½/var/lib/mysql/ÕâÁ½ÐУ¬×¢Ê͵ôÕâÁ½ÐУ¬ÔÚÕâÁ½ÐÐÇ°·Ö±ðÌí¼ÓÒ»¸ö·ûºÅ“#”¼´¿É×¢ÊÍ£¬ÔÚÕâÁ½ÐÐ֮ǰ»ò
Ö®ºó¼ÓÉÏÏÂÃæÄÚÈÝ£º
/home/mysql/ r,
/home/mysql/** rwk,
±£´æºóÍ˳ö£¬Ö´ÐÐÃüÁ
$sudo /etc/init.d/apparmor reload
·µ»ØReloading AppArmo ......
1¡¢½øÈëmysql£¬´´½¨Ò»¸öÐÂÓû§xuys£º
¸ñʽ£ºgrant ȨÏÞ on Êý¾Ý¿âÃû.±íÃû Óû§@µÇ¼Ö÷»ú identified by "Óû§ÃÜÂë";
grant select,update,insert,delete on *.* to xuys@192.168.88.234 identified by "xuys1234";
²é¿´½á¹û£¬Ö´ÐУº
use mysql;
select host,user,p ......
<!--#include file="zheboconn.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>aspºÍmysql·ÖÒ³´úÂë</title>
<style type="text/css">
<!--
.STYLE3 {
fon ......
MySQL Workbench ÊÇ MySQL ×î½üÊͷŵĿÉÊÓÊý¾Ý¿âÉè¼Æ¹¤¾ß¡£Õâ¸ö¹¤¾ßÊÇÉè¼Æ MySQL Êý¾Ý¿âµÄרÓù¤¾ß¡£
ÄãÔÚ MySQL Workbench Öн¨Á¢µÄ±»³Æ֮ΪÎïÀíÊý¾ÝÄ£ÐÍ¡£Ò»¸öÎïÀíÊý¾ÝÄ£ÐÍÊÇÕë¶ÔÒ»¸öÌض¨ RDBMS ²úÆ·µÄÊý¾ÝÄ£ÐÍ£»±¾ÎÄÖеÄÄ£Ðͽ«¾ßÓÐһЩ MySQL µÄ¶ÀÌع淶¡£ÎÒÃÇ¿ÉÒÔʹÓÃËüÉú³É£¨forward-engineer£©Êý¾Ý¿â¶ÔÏ󣬳ýÁË°üº¬± ......