centos下mysql的安装与配置

    xiaoxiao2021-12-03  36

    安装

    1 yum list mysql-server

    [join@bogon 桌面]$ yum list mysql-server Loaded plugins: fastestmirror, refresh-packagekit, security Determining fastest mirrors * base: mirror.bit.edu.cn * extras: mirrors.yun-idc.com * updates: mirror.bit.edu.cn base | 3.7 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 Available Packages mysql-server.x86_64 5.1.73-7.el6 bas

    2 yum install mysql-server

    [root@bogon 桌面]# yum install mysql-server.x86_64 Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile * base: mirrors.yun-idc.com

    3 y

    Is this ok [y/N]: y Downloading Packages: (1/5): mysql-5.1.73-7.el6.x86_64.rpm | 894 kB 00:02 (2/5): mysql-libs-5.1.73-7.el6.x86_64.rpm | 1.2 MB 00:10

    启动

    1 service mysqld start

    [root@bogon 桌面]# service mysqld start 初始化 MySQL 数据库: WARNING: The host 'bogon' could not be looked up with resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MySQL privileges ! Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system 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 bogon 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. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! [确定] 正在启动 mysqld: [确定] [root@bogon 桌面]#

    设置mysql开机启动

    chkconfig mysqld on

    开启3306端口并保存

    /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

    /etc/rc.d/init.d/iptables save

    修改密码并设置远程访问

    1

    连接mysql数据库

    设置密码

    use mysql;

    update user set password=password('密码') where user='root';

    flush privileges;

    2

    设置Mysql远程访问

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

    重启mysql服务

    service mysald restart

    转载请注明原文地址: https://ju.6miu.com/read-680193.html

    最新回复(0)