linux yum 安装 配置 使用 mysql
1.切换到root用户2.安装:# yum install mysql-server3.检查:# chkconfig --list | grep mysql 可以看到mysqld0:off1:off2:off3:off4:off5:off6:off表示安装成功4.启动:# service mysqld start 可以看到:Initi
1.切换到root用户
2.安装:# yum install mysql-server
3.检查:# chkconfig --list | grep mysql 可以看到
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
表示安装成功
4.启动:# service mysqld start 可以看到:
Initializing MySQL database: 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 l 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!
[ OK ]
Starting mysqld: [ OK ]
上面提示需要设置用户名和密码,可选的是通过:/usr/bin/mysql_secure_installation
5.执行:# /usr/bin/mysql_secure_installation
初始化密码为空,直接回车进入重置密码过程,其后的确认过程一律选择:[ y ] 回车即可。
=======以下是数据库相关操作======
注意:新建立用户无法登录,需要root执行命令:flush privileges;
6.root用户登录mysql: # mysql -u root -p 输入密码即可
7.查看所有数据库:mysql> show databses;
8.创建测试数据库:mysql> create database testdb;
9.检查创建的数据库:mysql> show databases; 可以看到已经存在
10.切换使用数据库:mysql> use testdb;
11.创建一个user表:mysql> create table user(name varchar(200));
11.查看当前数据库表:mysql> show tables; 可以看到表已创建
结束。
更多推荐
所有评论(0)