数据库


98_MySQL常用命令

<h2>命令列表:</h2> <h3>1、如何查看mysql版本</h3> <pre><code class="language-bash">[root@localhost ~]# mysql -V [root@localhost ~]# mysql -uroot -p # 登录时显示mysql版本号 MariaDB [(none)]&gt; select version(); MariaDB [(none)]&gt; status; MariaDB [(none)]&gt; \s [root@FaceServer ~]# mysql -? [root@FaceServer ~]# mysql --help [root@FaceServer ~]# mysql -I # (大写的i)</code></pre> <h3>2、在Linux命令行下执行mysql脚本文件</h3> <h4>2.1 创建数据库</h4> <h5>(1)登录mysql</h5> <pre><code class="language-bash">mysql -uroot -p mysql&gt; ##### (2)执行脚本 mysql&gt; source /root/EasyTong_MySQL_01_CreateDataBase.sql; #易通创建数据库;</code></pre> <h4>2.2、给某个数据库执行脚本</h4> <h5>(1)登录mysql</h5> <pre><code class="language-bash">[root@localhost ~]# mysql -uroot -p [root@localhost ~]# mysql&gt;</code></pre> <h5>(2)选择要操作的数据库</h5> <pre><code class="language-bash">[root@localhost ~]# mysql&gt;use easytongdb;</code></pre> <h5>(3)执行数据库脚本;</h5> <pre><code class="language-bash">[root@localhost ~]# mysql&gt;EasyTong_MySQL_02_CreateTable.sql;</code></pre> <h5>2、其它命令</h5> <pre><code class="language-bash">c b a </code></pre>

页面列表

ITEM_HTML