mysql安装问题

1.查看mysql安装目录
dpkg -S mysql

2.mysqlconf文件路径
/ect/mysql/my.cnf

3.mysql允许远程访问
登录mysql执行下面两个语句,意思允许外部IP访问
grant all privileges on *.* to root@"%" identified by "passw0rd" with grant option;
FLUSH PRIVILEGES;
执行上面之后还是不行,上网查了一下还需要修改my.conf把skip-network中bind address注释掉.

4.mysql启动,关闭,状态
sudo /etc/init.d/mysql start
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql status

也可以是sudo service mysql start,注意必须实用sudo或root权限。

5.查看mysql端口:
netstat -lpnut | grep mysql
----------------------------------------------------------------------------------------------------------------------------------
mysql乱码问题:
1.修改my.cnf
在[client]下添加
default-character-set=utf8

在[mysqld]下添加
default-character-set=utf8
2.重启mysql

3.查看修改效果

mysql> show variables like 'collation_%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.02 sec)

mysql> show variables like 'character_set_%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.02 sec)

4.jdbc的URL后面设置UTF-8编码:jdbc:mysql://127.0.0.1/ocndb?useUnicode=true&characterEncoding=utf-8
注意autoReconnect=tue没有必要实用了,参考:http://bzhang.iteye.com/blog/321832

--------------------------------------------------------------------------------
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h v151.cqxunmei.com password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值