Linux安装mysql(Ubuntu)

一、安装

apt-get update
apt-get install mysql-server
sudo apt-get install mysql-client
apt-get install libmysqlclient-dev

二、配置

#连接mysql

mysql -u root -p

2.1.建库授权

create database jz default character set utf8 collate utf8_general_ci;

create user 'admin'@'%' identified by 'root';

grant all privileges on *.* to admin;

grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;

grant all privileges on *.* to 'admin'@'%' identified by 'root' with grant option;
 
 
FLUSH PRIVILEGES;

2.2.配置文件

cat /etc/mysql/mysql.conf.d/mysqld.cnf

bind-address = 0.0.0.0
lower_case_tables_name = 1

#停止
/etc/init.d/mysql stop

#启动
/etc/init.d/mysql start

netstat -nltp  | grep 3306 
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容