安装MySQL数据库的步骤如下:
tar -zxvf mysql-x.x.x-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
groupadd mysql
useradd -r -g mysql -s /sbin/nologin mysql
chown -R mysql:mysql /usr/local/mysql-x.x.x-linux-glibc2.12-x86_64/
cd /usr/local/mysql-x.x.x-linux-glibc2.12-x86_64/
./bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql-x.x.x-linux-glibc2.12-x86_64/ --datadir=/usr/local/mysql-x.x.x-linux-glibc2.12-x86_64/data/
./bin/mysqld_safe --user=mysql --basedir=/usr/local/mysql-x.x.x-linux-glibc2.12-x86_64/ --datadir=/usr/local/mysql-x.x.x-linux-glibc2.12-x86_64/data/ &
cp support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql
chkconfig mysql on
./bin/mysql -uroot -p
CREATE DATABASE mydatabase;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
以上步骤是安装和配置MySQL数据库的基本流程,更详细的MySQL配置和管理可以参考腾讯云提供的MySQL产品文档:https://cloud.tencent.com/document/product/236/3130
领取专属 10元无门槛券
手把手带您无忧上云