linux进入数据库命令

linux进入数据库命令,第1张

     在linux使用命令进入数据库总共有两个步骤,下面是具体 *** 作:

      1、首先打开linux系统,启动mysql数据库。

      2、然后输入命令mysql-uroot-p1,即输入账号密码等信息就能够进入mysql数据库了。

      以上就是的分享了,希望能够帮助到大家。

在linux下安装mysql数据库并配置的流程比较繁琐,需要耐心调试,具体方法和步骤如下:

1.查找以前是否安装有mysql,使用下面命令:

rpm -qa|grep -i mysql

如果显示有如下包则说明已安装mysql

mysql-4.1.12-3.RHEL4.1

mysqlclient10-3.23.58-4.RHEL4.1

2.如果已安装,则需要删除已安装的数据库,使用以下命令来删除数据库

删除命令:rpm -e --nodeps 包名

( rpm -ev mysql-4.1.12-3.RHEL4.1 )

删除老版本mysql的开发头文件和库

命令:rm -fr /usr/lib/mysql

rm -fr /usr/include/mysql

注意:卸载后/var/lib/mysql中的数据及/etc/my.cnf不会删除,如果确定没用后就手工删除

rm -f /etc/my.cnf

rm -fr /var/lib/mysql

3.下载mysql的rpm包

可以通过wget下载具体的地址因为不能用链接请大家去官网去找

(1)MySQL-server-5.6.10-1.rhel5.x86_64.rpm:MySQL服务器;

(2)MySQL-client-5.6.10-1.rhel5.x86_64.rpm:MySQL客户端;

(3)MySQL-devel-5.6.10-1.rhel5.x86_64.rpm:Mysql开发依赖包。

下载后放到Liunx服务器中。

4.安装MySQL Server的rpm包

rpm -ivh MySQL-server-5.6.21-1.linux_glibc2.5.x86_64.rpm

安装完成后会生成root用户的随机密码,请使用“cat /root/.mysql_secret”或类似命令进行查看。

5.安装MySQL客户端

rpm -ivh MySQL-client-5.6.21-1.linux_glibc2.5.x86_64.rpm

6.安装MySQL开发依赖包

rpm -ivh MySQL-devel-5.6.21-1.linux_glibc2.5.x86_64.rpm

7.启动msyql

安装完成后mysql是没有启动的,运行mysql命令会提示如下错误:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

可使用如下命令启动MySQL:

service mysql start

或者使用如下命令:

/etc/init.d/mysql start

可使用SET PASSWORD命令修改root用户的密码,参考如下:SET PASSWORD = PASSWORD('root123456')

8.登录MySQL

使用mysql命令登录MySQL服务器,运行MySQL的命令时,会提示需要设置root用户密码。

9.设置开机自启动

/etc/init.d/mysql start

设置完成后重启系统,使用natstat –nat命令可看到MySQL的3306端口。

10.至此已经安装好了mysql数据库,当然现在我们的数据库还不支持远程连接,远程连接会出现以下代码:1130,ERROR 1130: Host 192.168.0.10 is not allowed to connect to this MySQL server,可以通过以下以下来解决。

11.改表法:在本机登入mysql后,更改“mysql”数据库里的“user”表里的“host”项,从”localhost”改为'%'。

mysql>

mysql>use mysql

mysql>select 'host' from user where user='root

12.到此为止,mysql数据库在linux中安装完毕。

在 Linux 上安装 Oracle 数据库 11g目的在本教程中,您将会学习如何在 Linux 安装 Oracle 数据库 11g.

主题本教程包括下列主题:

概述在 Linux 上安装 Oracle 数据库 11g测试安装总结

概述您将使用 Oracle Universal Installer 来安装 Oracle 数据库 11g 软件并创建一个数据库。

返回主题列表

在 Linux 上安装 Oracle 数据库 11g要安装 Oracle 软件,必须使用 Oracle Universal Installer.

1. 在这一安装中,您需要使用 DVD 或下载 DVD 版本。在本教程中,将从已下载的版本进行安装。在 DVD 文件解压缩的目录中,打开终端窗口终入以下内容:

。/runInstaller.sh

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

2. 安装的产品为 Oracle Database 11g.选定该产品并单击 Next.

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

2. 您将通过一个入门级数据库来执行基本安装。输入 orcl 作为 Global Database Name 以及 oracle 作为 Database Password 并确认口令。然后单击 Next.

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

3. 您需要指定 Inventory 目录。位置应该设置为 /u01/app/oracle/oraInventory.接受默认的 Operating System 级名 oinstall.然后单击 Next.

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

4. 安装程序现在将验证系统是否满足安装和配置所选产品的最低要求。继续前改正任何报告的错误。检查成功完成后,单击 Next.

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

5. Oracle Configuration Manager 允许您将配置信息与 Metalink 帐户相关联。您可在该窗口上选择启用它。然后单击 Next.

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

4. 安装程序现在将验证系统是否满足安装和配置所选产品的最低要求。继续前改正任何报告的错误。检查成功完成后,单击 Next.

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

5. Oracle Configuration Manager 允许您将配置信息与 Metalink 帐户相关联。您可在该窗口上选择启用它。然后单击 Next.

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

5. 查看 Summary 窗口,验证要安装的内容。然后单击 Install.

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

6. 进度窗口显示。

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

7. Configuration Assistants 窗口显示。

=780) window.open('')" src=""javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

8. 正在创建数据库。

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

9. 创建了数据库之后,可以解锁您要使用的用户。单击 OK.

=780) window.open('')" src=""javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

10. 您需要以 root 用户身份执行 orainstRoot.sh 和 root.sh

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

11. 打开终端窗口输入以下命令。按提示输入内容。

su - <rootpassword>cd /u01/app/oracle/oraInventory。/orainstRoot.sh cd ……/product/11.1.0/db_1。/root.sh exit

=780) window.open('')" src=""javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

12. 切换回 Universal Installer 并单击 OK.

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

13. 单击 Exit.单击 Yes 确认退出。

=780) window.open('')" src=""javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

返回主题列表

测试安装要测试安装是否成功完成,请执行以下步骤:

1. 打开一个浏览器,输入以下 URL:

>:1158/em

其中 <hostname>应更改为您的机器名、IP 地址或 localhost.

因为企业管理器数据库控制是一个安全站点,因此您需要一个证书。选择 Accept this certificate permanently 选项,然后单击 OK.

=780) window.open('')" src=""javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

2. 输入 system 作为 User Name 以及 oracle 作为 Password,然后单击 Login.

=780) window.open('')" src="" javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">

3. 数据库控制主页显示。安装成功。

=780) window.open('')" src=""javascript:if(this.width>'780')this.width='780'setTimeout('if(document.getElementById(\'\').height>\'700\')document.getElementById(\'\').height=\'700\'',500)" border=0 twffan="done">


欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/yw/8687445.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-19
下一篇2023-04-19

发表评论

登录后才能评论

评论列表(0条)

    保存