mysql學習筆記
select substring(now(),1,10);
mysql登錄 大寫字母P是端口
C:\Program Files\MySQL\MySQL Server 5.6\bin>
mysql -h 127.0.0.1 -P -u root -p
設置root帳戶的密碼
mysql> set password for 'xp'@'127.0.0.1'=password('xp132018');
修改密碼:
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysqladmin -u root -ppasswd password abc
mysql數據庫遠程:
grant all PRIVILEGES on *.* to 'root'@'192.168.0.%' identified by '3613571';
flush privileges;
(第一個*是數據庫,第二個* 表示數據庫中的表, win表明帳戶,%表明ip地址, win456 表明帳戶密碼)
show databases;
use TD_OA;
show tables;
select * from user;
select * into outfile 'd:/test.xls' from 表名
create table aaa (ID INT(11),NAME varchar(255));
insert into student values('102','李四','八年級');
drop table student; 刪除表
數據庫的備份
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqldump.exe -u root -p mysql student > mysql_bak.sql (備份指定的mysql數據庫的student表)
mysqldump.exe -u root -p mysql > mysql_bak.sql (備份數據庫mysql中的所有表)
數據庫的還原
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -u root -p mysql < mysql_bak.sql
grant replication slave on *.* to 'xp'@'192.168.1.9' identified by 'xp456' with grant option;
change master to master_host='192.168.1.10',master_user='xp',master_password='xp456',master_log_file='mysql-bin.000013' ,master_log_pos=107;
mysql 服務的安裝
mysqld --install MySQL --defaults-file=D:\hyk\mysql55\my.ini
net start mysql
mysql服務的卸載
net stop mysql
mysqld -remove
mysql