一.初始化
1.mysql初始化
mysqld --initialize-insecure --
mysql -u root
set password =password('123456');
2.修改端口后登入
mysql -P3396 -uroot -p
3.允许mysql远程登入
mysql -u root -p
mysql>use mysql; mysql>update user set host = '%' where user = 'root'; mysql>select host, user from user;创建管理员用户 -- use mysql @ '%' 可以远程连接 既可以远程登入又可以创建表格
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'estar'@'%' IDENTIFIED BY 'Jxestar999' WITH GRANT OPTION;
删除一个用户:
mysql > Delete FROM user Where User='test' and Host='localhost';
mysql> flush privileges;
4.注册到服务器
mysqld -install mysqlCwp --defaults-file="d:\mysql5.1\my.ini"
5.删除服务
mysqld --remove mysql(服务名字)
二. 设置字符集, 防止中文乱码
1.设置中文字符
[client]
default-character-set=utf82. jdbc访问地址
url= jdbc:mysql://groupServer2:3306/drawmysql?useUnicode=true&characterEncoding=UTF-8