Parameters: -p: oracle database password, default for 'sys' -v: oracle-e version EOF }
while getopts "hp:v:" optname; do case "${optname}" in "h") usgae exit 0 ;; "p") PASSWORD="${OPTARG}" ;; "v") VERSION="${OPTARG}" ;; esac done
CONTAINER_RUNTIME=$(which docker 2>/dev/null) || { echo "There is no docker in your PATH" exit 1 }
arch=$(uname -m) if [ $arch = "arm64" ] then echo "Run oracle database on Apple M chip." COLIMA=$(which colima) if [ -z $COLIMA ] then echo "No colima, try to install..." brew_run=$(which brsew) && { ${brew_run} install colima; } || mac_port_run=$(which port) && { ${mac_port_run} install colima; } || nix_run=$(which nix-env) && { ${nix_run} -iA nixpkgs.colima; } || { echo "Colima is available on Homebrew, MacPorts, and Nix." echo "But now, can't found any of them." exit 1 } fi
colima start --arch x86_64 --memory 4 fi
if [ -z $PASSWORD ] then PASSWORD=sys fi
PORT=1521 ${CONTAINER_RUNTIME} run -d -p ${PORT}:1521 -e ORACLE_PASSWORD=${PASSWORD} gvenzl/oracle-xe:${VERSION}
echo "Oracle-xe start with port ${PORT}" echo "Oracle password: ${PASSWORD}" # stop and delete colima instance # colima stop # colima delete # This is not a good idea delete colima instance, delete instance will delete # all context for colima, of course, include image in this instance.
这个脚本暂时没有编写结束相关,参数相关内容,所以只能用作简单的启动脚本
Appendix
Colima - container runtimes on macOS (and Linux) with minimal setup.
# WARNING: This is wrong for multi-config generators because they don't use # and typically don't even set CMAKE_BUILD_TYPE string(TOLOWER ${CMAKE_BUILD_TYPE} build_type) if (build_type STREQUAL debug) target_compile_definitions(exe1 PRIVATE DEBUG_BUILD) endif()
private Set<String> sources = new LinkedHashSet<>(); //... public void addPrimarySources(Collection<Class<?>> additionalPrimarySources) { this.primarySources.addAll(additionalPrimarySources); } public void setSources(Set<String> sources) { Assert.notNull(sources, "Sources must not be null"); this.sources = new LinkedHashSet<>(sources); } }
//... /** Cache of singleton objects: bean name to bean instance. */ privatefinal Map<String, Object> singletonObjects = newConcurrentHashMap<>(256);
/** Cache of singleton factories: bean name to ObjectFactory. */ privatefinal Map<String, ObjectFactory<?>> singletonFactories = newHashMap<>(16);
/** Cache of early singleton objects: bean name to bean instance. */ privatefinal Map<String, Object> earlySingletonObjects = newConcurrentHashMap<>(16);
首先,需要注意my.ini的位置,一般,my.ini会在两个地方,第一个位置是在安装mysql服务的位置(举例, C:/Program Files/MySQL/MySQL Server X.Y),第二个位置地方则是Data的同级目录下(举例, datadir的路径是C:/ProgramData/MySQL/MySQL Server 8.0/Data,则my.ini的位置是 C:/ProgramData/MySQL/MySQL Server 8.0/my.ini)。
To cause a server started with --skip-grant-tables to load the grant tables at runtime, perform a privilege-flushing operation, which can be done in these ways:
Issue a MySQL FLUSH PRIVILEGES statement after connecting to the server.
Execute a mysqladmin flush-privileges or mysqladmin reload command from the command line.
修改密码
这一个就是常规操作,简略地提供一种方法
1
MariaDB [(none)] > ALTER USER 'root'@'localhost' IDENTIFIED BY '<your_passcode>';