Linux系统如何安装配置Mysql服务

2025-04-19 19:25:12

1、以root身份登录linux系统

Linux系统如何安装配置Mysql服务

2、安装mysql-serverapt-get install mysql-server

Linux系统如何安装配置Mysql服务

3、查看是否安装成功并启动netstat -tap | grep mysql

Linux系统如何安装配置Mysql服务

4、mysql在安装完成后自动启咿蛙匆盗动,root账号密码为系统root密码mysqladmin --version 查看mysql版本sudo service mysql status 查看mysql状态sudo service mysql start 启动mysql服务sudo service mysql stop 停止mysql

Linux系统如何安装配置Mysql服务

5、使用root登录mysql:shell>mysql -u root -p

Linux系统如何安装配置Mysql服务

6、添加其他账号并授权:mysql>create user 'admin'@'lo艘早祓胂calhost' identified by 'pwd';mysql>grant all privileges on *.* to 'admin'@'localhost' with grant option;指定域名,指定权限,指定databasemysql>create user 'dever'@'%.xxx.com'identified by 'pwd';mysql>grant select,delete,drop,insert,update,create on your_database.* to 'dever'@'%.xxx.com';

7、查看用户 select host,user from user;

Linux系统如何安装配置Mysql服务

8、开启mysql远程访问:修改mysql配置文件:vi /etc/mysql/mysql.conf.d/mysqld.cnf把其中bind-address = 127.0.0.1注释掉:

Linux系统如何安装配置Mysql服务

9、登陆mysql修改权限mysql>grant all on *.* to root@'%' identified 芟鲠阻缒by 'pwd';flush privileges;service mysql restart

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢