Linux下apt-get安装MySQL
apt-get install mysql-server
apt-get install mysql-client
mysql -u root -p进入mysql命令行,用set password命令修改密码
1
2SET PASSWORD FOR 'root'@'localhost'=PASSWORD(‘localhost login password');
SET PASSWORD FOR'root'@'%'=PASSWORD(‘remote login password');大坑-mysql不能远程访问
gedit /etc/mysql.my.cnf
找到bind-address =127.0.0.1
修改为bind-address =0.0.0.01
2
3# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0授权远程ip登录
1
2GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;修改字符集解决中文乱码问题
my.cnf中mysqld添加配置
1
2character-set-server=utf8mb4
init-connect = "SET NAMES utf8mb4"