MySql»ù´¡ÖªÊ¶(¾µä°æ)
Ò»¡¢mysql µÄ¹ÜÀí
1
¡¢Á¬½Ó
Mysql
¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû £pÓû§ÃÜÂë
Àý1£ºÁ¬½Óµ½±¾»úÉϵÄMYSQL¡£
Ê×ÏÈÔÚ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëĿ¼ mysqlbin£¬ÔÙ¼üÈëÃüÁîmysql -uroot -p£¬»Ø³µºóÌáʾÄãÊäÃÜÂ룬Èç¹û¸Õ°²×°ºÃMYSQL£¬³¬¼¶Óû§rootÊÇûÓÐÃÜÂëµÄ£¬¹ÊÖ±½Ó»Ø³µ¼´¿É½øÈëµ½MYSQLÖÐÁË£¬MYSQLµÄÌáʾ·ûÊÇ£ºmysql>
Àý2£ºÁ¬½Óµ½Ô¶³ÌÖ÷»úÉϵÄMYSQL¡£¼ÙÉèÔ¶³ÌÖ÷»úµÄIPΪ£º110.110.110.110£¬Óû§ÃûΪroot,ÃÜÂëΪabcd123¡£Ôò¼üÈëÒÔÏÂÃüÁ
mysql -h110.110.110.110 -uroot -pabcd123
£¨×¢:uÓëroot¿ÉÒÔ²»Óüӿոñ£¬ÆäËüÒ²Ò»Ñù£©
2
¡¢Í˳öMYSQLÃüÁ exit £¨»Ø³µ£©
3
¡¢
ÐÞ¸ÄÃÜÂë
¸ñʽ£ºmysqladmin -uÓû§Ãû -p¾ÉÃÜÂë password ÐÂÃÜÂë
1) mysqladmin -uÓû§Ãû -p¾ÉÃÜÂë password ÐÂÃÜÂë
Àý£ºmysqladmin -u root password 21century
×¢£ºÒòΪ¿ªÊ¼Ê±rootûÓÐÃÜÂ룬ËùÒÔ-p¾ÉÃÜÂëÒ»Ïî¾Í¿ÉÒÔÊ¡ÂÔÁË¡£
2)Ö±½ÓÐÞ¸Äuser±íµÄrootÓû§¿ÚÁ
mysql> user mysql;
mysql> update user set pasword=password('21century') where user='root';
mysql> flush privileges;
×¢£ºflush privilegesµÄÒâ˼ÊÇÇ¿ÖÆË¢ÐÂÄÚ´æÊÚȨ±í£¬·ñÔòÓõĻ¹ÊÇ»º³åÖеĿÚÁî¡£
4
¡¢²âÊÔÃÜÂëÊÇ·ñÐ޸ijɹ¦
¡¡¡¡ 1£©²»ÓÃÃÜÂëµÇ¼
¡¡¡¡[root@test1 local]# mysql
¡¡¡¡ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
¡¡¡¡ÏÔʾ´íÎó£¬ËµÃ÷ÃÜÂëÒѾÐ޸ġ£
¡¡¡¡2£©ÓÃÐ޸ĺóµÄÃÜÂëµÇ¼
¡¡¡¡[root@test1 local]# mysql -u root -p
¡¡¡¡Enter password: (ÊäÈëÐ޸ĺóµÄÃÜÂë21century)
¡¡¡¡Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 177 to server version: 3.23.48
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
¡¡¡¡mysql>
¡¡¡¡³É¹¦£¡
¡¡¡¡ÕâÊÇͨ¹ýmysqladminÃüÁîÐ޸ĿÚÁҲ¿Éͨ¹ýÐ޸ĿâÀ´¸ü¸Ä¿ÚÁî
5¡¢Ôö¼ÓÐÂÓû§
£¨×¢Ò⣺ºÍÉÏÃ治ͬ£¬ÏÂÃæµÄÒòΪÊÇMYSQL»·¾³ÖеÄÃüÁËùÒÔºóÃ涼´øÒ»¸ö·ÖºÅ×÷ΪÃüÁî½áÊø·û£©
¸ñʽ£ºgrant select on Êý¾Ý¿â.* to Óû§Ãû@µÇ¼Ö÷»ú identified by "ÃÜÂë"
Àý1¡¢Ôö¼ÓÒ»¸öÓû§test1ÃÜÂëΪabc£¬ÈÃËû¿ÉÒÔÔÚÈκÎÖ÷»úÉϵǼ£¬²¢¶ÔËùÓÐÊý¾Ý
Ïà¹ØÎĵµ£º
MySQLÖÐÓкܶàµÄ»ù±¾ÃüÁshowÃüÁîÒ²ÊÇÆäÖÐÖ®Ò»£¬ÔںܶàʹÓÃÕßÖжÔshowÃüÁîµÄʹÓû¹ÈÝÒײúÉú»ìÏý£¬±¾ÎĻ㼯ÁËshowÃüÁîµÄÖÚ¶àÓ÷¨¡£
a. show tables»òshow tables from database_name; -- ÏÔʾµ±Ç°Êý¾Ý¿âÖÐËùÓбíµÄÃû³Æ¡£
b. show databases; -- ÏÔʾmysqlÖÐËùÓÐÊý¾Ý¿âµÄÃû³Æ¡£
c. show columns from table_nam ......
Ò»¸ö¼òµ¥Ê¾Àý--
1£¬×¼±¸£ºMySQLÊý¾Ý¿âÇý¶¯°ü¡¾mysql-connector-java-5.1.10-bin.jar¡¿µ¼Èë
2£¬´´½¨²âÊÔÁ¬½ÓÖ÷³ÌÐò
package mysqlConnection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class JdbcDemo {
public static void main(String[] args) {
......
ÕâÀï½éÉÜÒ»¸ö¼¯³É»·¾³ XAMPP¡£
XAMPP ÊÇÒ»¸öÒ×ÓÚ°²×°ÇÒ°üº¬ MySQL¡¢PHP ºÍ Perl µÄ Apache ·¢Ðа档XAMPP µÄÈ··Ç³£ÈÝÒ×°²×°ºÍʹÓãºÖ»ÐèÏÂÔØ£¬½âѹËõ£¬Æô¶¯¼´¿É¡£
ÏÂÔصØÖ·£º
http://www.apachefriends.org/zh_cn/xampp.html
µ½Ä¿Ç°ÎªÖ¹£¬XAMPP ¹²ÓÐÒÔÏÂËÄÖÖ°æ±¾£º
£¨1£©ÊÊÓÃÓÚ Linux µÄ XAMPP
£¨2£©ÊÊÓÃÓÚ Windows µ ......
½â¾ö·½·¨(ת)£º---µ«Ö´ÐеÚÒ»Öְ취ʱ³öÏÖ´íÎ󣬵ڶþÖÖ°ì·¨³É¹¦
1¡£¸Ä±í·¨¡£¿ÉÄÜÊÇÄãµÄÕʺŲ»ÔÊÐí´ÓÔ¶³ÌµÇ½£¬Ö»ÄÜÔÚlocalhost¡£Õâ¸öʱºòÖ»ÒªÔÚlocalhostµÄÄÇ̨µçÄÔ£¬µÇÈëmysqlºó£¬¸ü¸Ä "mysql" Êý¾Ý¿âÀïµÄ "user" ±íÀïµÄ "host" Ï´Ó"localhost"¸Ä³Æ"%"
mysql -u root -pvmwaremysql>use mysql;mysql>update use ......
Ôø¾Ê§°Ü¹ýn´Î£¬ÈÃÎÒÏ൱ÎÞÄÎ×îºóÖÕÓÚÕÒµ½ÁËÒ»¸ö½â¾ö·½°¸£¬¹©´ó¼Ò·ÖÏí
ɾµô×¢²á±íµÄ·½·¨£¬ÎÒÒ²Ôø¾Óùý£¬µ«×ÜÊÇʧ°Ü£¬½¨ÒéÈçÏÂ
Ò»£ºÏÈжÔØÈí¼þmysql
¶þ£ºÏÈɾע²á±íµÄ¶«Î÷£»
Èý£º×îºóÔÚÄãµÄµ±Ç°Óû§ÀïcÅÌÏÂC:\Documents and Settings\All Users\Application Data\ÕÒµ½mysqlµÄĿ¼£¬É¾µô£¬ÍüÁ˸æËßÒ»¾ä£»
ÄÇÊÇÒþ²ØÎļþ£ ......