安装
装更新软件
sudo apt-get install libaio1
配置
sudo dpkg-preconfigure mysql-community-server_*.deb
在这一步会出现一个UI页面,让你输入数据库root账号的密码,你可以设置一个,也可以参考下边官方文档给的介绍
Important
Make sure you remember the root password you set. Users who want to set a password later can leave the password field blank in the dialogue box and just press OK; in that case, root access to the server is authenticated using the MySQL Socket Peer-Credential Authentication Plugin for connections using a Unix socket file. You can set the root password later using mysql_secure_installation.
- 安装
sudo dpkg -i mysql-{common,community-client,client,community-server,server}_*.deb
sudo apt-get -f install
-
Here are where the files are installed on the system:
All configuration files (like my.cnf) are under /etc/mysql
All binaries, libraries, headers, etc., are under /usr/bin and /usr/sbin
The data directory is /var/lib/mysql
-
自己猜测,这里自动配置了很多,包括创建用户,设置目录,分配权限等等,这一步估计会自动生成一个mysql的用户,但是不知道这个mysql的用户的密码是多少,例如自动安装完成后,存放数据的目录是/var/lib/mysql
,进入到/var/lib
后,你使用ll
命令查看如下图,存放数据的目录mysql,所属的组是mysql用户的,但你还不知道密码,这个问题以后再去解决吧。
配置字符集
vi /etc/my.cnf【编辑配置文件,支持语言设置】
#
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
[mysql]
default-character-set=utf8
#
service mysql stop【重新启动mysql服务】
service mysql start