mysql授权、导入等基本操作
1、授权:
mysqladmin -uroot password rootpwd
mysql -uroot -prootpwd mysql -e "INSERT INTO user (Host,User,Password,ssl_cipher,x509_issuer,x509_subject) VALUES(‘%‘,‘username‘,‘pwd‘,‘‘,‘‘,‘‘);"
mysql -uroot -prootpwd mysql -e "GRANT ALL PRIVILEGES ON *.* TO ‘username‘@‘%‘ IDENTIFIED BY ‘pwd‘ ;"
mysql -uroot -prootpwd mysql -e "GRANT ALL PRIVILEGES ON *.* TO ‘username‘@‘127.0.0.1‘ IDENTIFIED BY ‘pwd‘ ;"
mysql -uroot -prootpwd mysql -e "GRANT ALL PRIVILEGES ON *.* TO ‘username‘@‘localhost‘ IDENTIFIED BY ‘pwd‘ ;"
mysql -uroot -prootpwd mysql -e "flush privileges;"
2、导入数据库
mysql -uusername -ppwd -e "source $path/aaa.sql ;"
mysql -uusername -ppwd dbname -e "source $path/add.sql ;"